GPIO access in routine called throught CallAfter
Gert van der Knokke (2794) 6 posts |
Hi, Trying to read the Raspberry Pi A+ GPIO registers from a small assembler routine which is called through the OS_CallAfter Vector but so far I am only reading zeroes.. I let OS_Memory calculate the translated address from &20200000 and store it in a variable which is set as a constant in my assembler routine. The GPIO port is setup with GPIO_WriteMode and such and works ok from with Basic itself. Am I correct in: 1) The routine is called in SVC mode? 2) The base address is correct for the Pi A+ ? 3) Is the translation for the GPIO address needed in SVC mode? Regards, |
Rick Murray (539) 13840 posts |
Where are you getting the GPIO address? If it is a physical address, you might need to get it mapped into some logical space that you can directly access? |
Gert van der Knokke (2794) 6 posts |
Hi Rick, This is what I use to map in the GPIO space: SYS “OS_Memory”,13+(1<<17),&20200000,&100 TO ,,,membase% At membase%+&34 I expect to read the GPIO pins but all I get are zeroes. The GPIO pins should be logically high by internal pullup. Even tried to read the whole 512 byte block but also just zeroes… Will try to put the code here tomorrow. maybe I am overlooking something. |
Gert van der Knokke (2794) 6 posts |
Got it, some mixup in addressing modes and the fact I am still fighting with the inline assembler of BBC Basic I can reliably read out the GPIO pins now. |