Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Read/write on Gpio real-time from uClinux?

I used pointer to access GPIOs :

#define LEDs(unsigned int *)(base_addr)

# define SWs (volatile unsigned int *)(base_addr)

I want to use gpio for controlling my device ip. With a same code C, it works FINE without OS (using eclipse) But incorrect in uClinux OS() .

(When i try to switch on-off to Gpio-Leds from Nios2-uClinux, it may not assign value immediately and very slow while my code assigns value continuously ....i think it is cause.

If you know, please explain to me why gpio controlling is so slow in linux (i'm newbie in embedded OS:D)

And is it beter if i add my ip direct to my SOPC(not through gpio)?

best regard!

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    How are you getting the value for 'base_address' in your linux version?

    It will need to bypass the data cache.

    You also need to be doing it from within a linux device driver.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi! I just have got it. Now i know how to bypass data cache and my system worked well. im student and this is my final project.

    Tks alot! love u. :D