Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20787 Discussions

Read/write on Gpio real-time from uClinux?

Altera_Forum
Honored Contributor II
1,170 Views

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!
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
343 Views

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.
0 Kudos
Altera_Forum
Honored Contributor II
343 Views

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
0 Kudos
Reply