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.
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.
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