Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Is GPIO on H3 SoC really this slow?

Featured Replies

 

Hello, I'm new here and do not quite understand the sub-forums here but hopefully this is the right one. 

I got an Orange pi ONE running 4.19 RT kernel with Armbian buster. 

Screenshot-from-2019-11-26-12-17-27.png

I was testing out the GPIO capabilities of the H3 SoC without any libraries and got only 1.67 Mhz at best(which is ironically the same as WiringPIOP) with some task interrupt issues.

#define INP_GPIO(g) *(unsigned int *)(gpio+0x04) &= ~(7 << (((g) % 10) * 3)) 
//I did not thoroughly check if the mapping is okay 
#define OUT_GPIO(g){\
                      *(unsigned int *)(gpio+0x04)   &=  ~(6 << (((g) % 8) * 4));\
                      *(unsigned int *)(gpio+0x04)   |=   (1 << (((g) % 8) * 4));\
                   }
#define GET_GPIO(g) (*(unsigned int *)(gpio+0x10) & (1<<g))// 0 if LOW, (1<<g) if HIGH
#define GPIO_SET(g) if(!GET_GPIO(g)){*(unsigned int *)(gpio+0x10)   |= (1 << g);}
#define GPIO_CLR(g)  if(GET_GPIO(g)){*(unsigned int *)(gpio+0x10)   &= ~(1<< g);} 
//after accessing /dev/mem
OUT_GPIO(12);
for(;;)
{	  
  GPIO_SET(12);
  GPIO_CLR(12);
}

The result is pretty inconsistent but at least works (any suggestions?).

One could say remove the if statement(got 2Mhz) but that makes the output even more bizarre.

Screenshot-from-2019-11-26-12-24-44.png

At this point i am quite stuck and not sure how to get a faster result with correct timing when rising and falling. 

Any suggestions for this would be helpful.

 

Thank you! 

 

test.cpp

Edited by fourtyseven
Forgot to attach the actual code

  • Author

Okay so after some fiddling around with registers;it seems like 1.6Mhz is the best for stability and the results seems quite consistent when the pin is checked if it actually changed the register or not.  

image.thumb.png.a274b65ba241dd041469ee6574051799.png

 

#define GET_GPIO(g) (*(unsigned int *)(gpio+0x10) & (1<<g))// 0 if LOW, (1<<g) if HIGH
#define GPIO_SET(g) if(!GET_GPIO(g)){*(unsigned int *)(gpio+0x10)   |= (1 << g);}
#define GPIO_CLR(g)  if(GET_GPIO(g)){*(unsigned int *)(gpio+0x10)   &= ~(1<< g);} 

This is still disappointing but i guess its a 'one up' from the previous results.

Edited by fourtyseven
syntax cleanup

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.