kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* SPI over GPIO
@ 2011-03-11 10:34 Alexandru Caramida
  2011-03-11 10:44 ` Tirtha Ghosh
  2011-03-11 11:08 ` Kaustubh Ashtekar
  0 siblings, 2 replies; 6+ messages in thread
From: Alexandru Caramida @ 2011-03-11 10:34 UTC (permalink / raw)
  To: kernelnewbies

Hello everyone,

I am trying to emulate an SPI interface using four GPIO pins. This is a desktop 
computer with linux 2.6.28 kernel.

The problem is I don't know if the pins are working. I read that if I have the 
sysfs support for the kernel (which I do :D) all I have to do
is enable the respectiv pin using 

echo N > /sys/class/gpio/export

And I would get a gpioN directory 

But I always get: "write error : invalid argument."

Is there some other option i need to enable first? The people I am working with 
assured me that these pins are not used by any other device and they haven't 
found anything to suggest that they were turned off manualy.

Please help,


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110311/feb7773d/attachment.html 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* SPI over GPIO
  2011-03-11 10:34 SPI over GPIO Alexandru Caramida
@ 2011-03-11 10:44 ` Tirtha Ghosh
  2011-03-11 11:08 ` Kaustubh Ashtekar
  1 sibling, 0 replies; 6+ messages in thread
From: Tirtha Ghosh @ 2011-03-11 10:44 UTC (permalink / raw)
  To: kernelnewbies

Have you try setting GPIO direction to out before writing to it???
give a shot.

follow: http://sites.google.com/site/bifferboard/Home/gpio



On Fri, Mar 11, 2011 at 4:04 PM, Alexandru Caramida <
alexandruc1723@yahoo.com> wrote:

> Hello everyone,
>
> I am trying to emulate an SPI interface using four GPIO pins. This is a
> desktop computer with linux 2.6.28 kernel.
>
> The problem is I don't know if the pins are working. I read that if I have
> the sysfs support for the kernel (which I do :D) all I have to do
> is enable the respectiv pin using
>
> echo N > /sys/class/gpio/export
>
> And I would get a gpioN directory
>
> But I always get: "write error : invalid argument."
>
> Is there some other option i need to enable first? The people I am working
> with assured me that these pins are not used by any other device and they
> haven't found anything to suggest that they were turned off manualy.
>
> Please help,
>
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110311/aa8f3f7c/attachment.html 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* SPI over GPIO
  2011-03-11 10:34 SPI over GPIO Alexandru Caramida
  2011-03-11 10:44 ` Tirtha Ghosh
@ 2011-03-11 11:08 ` Kaustubh Ashtekar
  2011-03-11 16:31   ` Vic
  1 sibling, 1 reply; 6+ messages in thread
From: Kaustubh Ashtekar @ 2011-03-11 11:08 UTC (permalink / raw)
  To: kernelnewbies

Please paste the full log of what you typed on the console and also
paste output of:

strace <your full command>

On Fri, Mar 11, 2011 at 4:04 PM, Alexandru Caramida
<alexandruc1723@yahoo.com> wrote:
> Hello everyone,
> I am trying to emulate an SPI interface using four GPIO pins. This is a
> desktop computer with linux 2.6.28 kernel.
> The problem is I don't know if the pins are working. I read that if I have
> the sysfs support for the kernel (which I do :D) all I have to do
> is enable the respectiv pin using
> echo N > /sys/class/gpio/export
> And I would get a gpioN directory
> But I always get: "write error : invalid argument."
> Is there some other option i need to enable first? The people I am working
> with assured me that these pins are not used by any other device and they
> haven't found anything to suggest that they were turned off manualy.
> Please help,
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* SPI over GPIO
  2011-03-11 11:08 ` Kaustubh Ashtekar
@ 2011-03-11 16:31   ` Vic
  2011-03-12 21:03     ` LILO jump/retf question Andrzej Kardas
  0 siblings, 1 reply; 6+ messages in thread
From: Vic @ 2011-03-11 16:31 UTC (permalink / raw)
  To: kernelnewbies

Try setting 3 Pins as Out (Clk, CS, MOSI (MasterDataOUT)) and 1 as IN
for MISO (MasterDataIn)

On Fri, Mar 11, 2011 at 3:08 AM, Kaustubh Ashtekar <ksashtekar@gmail.com> wrote:
> Please paste the full log of what you typed on the console and also
> paste output of:
>
> strace <your full command>
>
> On Fri, Mar 11, 2011 at 4:04 PM, Alexandru Caramida
> <alexandruc1723@yahoo.com> wrote:
>> Hello everyone,
>> I am trying to emulate an SPI interface using four GPIO pins. This is a
>> desktop computer with linux 2.6.28 kernel.
>> The problem is I don't know if the pins are working. I read that if I have
>> the sysfs support for the kernel (which I do :D) all I have to do
>> is enable the respectiv pin using
>> echo N > /sys/class/gpio/export
>> And I would get a gpioN directory
>> But I always get: "write error : invalid argument."
>> Is there some other option i need to enable first? The people I am working
>> with assured me that these pins are not used by any other device and they
>> haven't found anything to suggest that they were turned off manualy.
>> Please help,
>>
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* LILO jump/retf question
  2011-03-11 16:31   ` Vic
@ 2011-03-12 21:03     ` Andrzej Kardas
  2011-03-13  8:31       ` Mulyadi Santosa
  0 siblings, 1 reply; 6+ messages in thread
From: Andrzej Kardas @ 2011-03-12 21:03 UTC (permalink / raw)
  To: kernelnewbies

Hi,

I have been exploring  lilo bootloader last days, and i have a question:

There is piece of code in file bootsect.S like this:

;       jmpi    go,INITSEG         ; this line is commented out
         push    es
         push    #go
         retf

i wonder if are there any benefits of replacing line

jmpi    go,INITSEG  ; which, i think is more readable

by

push    es
push    #go
retf

besides to make people confused?

--
regards
Andrzej Kardas
http://www.linux.mynotes.pl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* LILO jump/retf question
  2011-03-12 21:03     ` LILO jump/retf question Andrzej Kardas
@ 2011-03-13  8:31       ` Mulyadi Santosa
  0 siblings, 0 replies; 6+ messages in thread
From: Mulyadi Santosa @ 2011-03-13  8:31 UTC (permalink / raw)
  To: kernelnewbies

Hi....

Not a pro asm coder, but here's what I think...

On Sun, Mar 13, 2011 at 04:03, Andrzej Kardas <andrzej-kardas@o2.pl> wrote:
> i wonder if are there any benefits of replacing line
>
> jmpi ? ?go,INITSEG ?; which, i think is more readable
>
> by
>
> push ? ?es
> push ? ?#go
> retf
>
> besides to make people confused?


hm, I just read about retf here:
http://stackoverflow.com/questions/1396909/ret-retn-retf-how-to-use-them

and.... I think, personally, the push-push-retf is more readable. By
pushing the values into the stack and do far return, it's easy to
interpret that "we jump into return value which we should find in
stack"

The readability I point here is more like "do goto vs don't do goto".
Although in assembly, we're not forced to do everything structurally,
but it's better to avoid it. Let me guess, the context of the above
"retf" is to exit from somekind of "function"?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-13  8:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-11 10:34 SPI over GPIO Alexandru Caramida
2011-03-11 10:44 ` Tirtha Ghosh
2011-03-11 11:08 ` Kaustubh Ashtekar
2011-03-11 16:31   ` Vic
2011-03-12 21:03     ` LILO jump/retf question Andrzej Kardas
2011-03-13  8:31       ` Mulyadi Santosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).