LS1043A GPIO addressing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LS1043A GPIO addressing

Jump to solution
374 Views
endrunner_smw
Contributor III

Perhaps somebody can assist me in further understanding the GPIO listings.

Cross referencing LS1043A.pdf and LS1043ARM.pdf

Documentation shows that pin M2 with RCW[uart_base] = 5 should be GPIO1_22.

If I use:

gpiomon gpiochip0 22

which should monitor GPIO1_22 I do get reply messages when using the button attached. So that should be correct.

However, when utilizing the memory mapped io for the GPIO the bit position doesn't match up with GPIO1_22.

Utilizing the GPIO base of 0x230_0000 (adding underscore for easier reading), then the offset for GPIODAT, we get a 32 bit value that each bit represents a GPIO pin, correct? If this is the case I would assume the bit associated with line 22 would have the hex value 0x20_0000, however I get no reply in my simple test program. However, after reviewing the whole 32 bit value to determine which bit was flipping on button press it was value 0x2_0000. This value would indicate GPIO1_18, correct? And GPIO1_18 should not be enabled if using RCW[UART_BASE]=5 because that line would be UART2_SIN.

So how is my button supposedly working on GPIO1_18, but my UART2 is also working? Am I misunderstanding how the multiplex works, am I misunderstanding notation somewhere? And this isn't the only button reporting incorrectly, but it seems the most nonsensical as it should be the UART2_SIN

0 Kudos
1 Solution
331 Views
endrunner_smw
Contributor III

I'll leave this up in case anyone runs into the same issue.

Long story short, I was not byte swapping correctly. I was taking the full 32bit value and reversing it, instead of reversing each 8 bit block within that 32bit value.

Learn from my mistake and have fun with those GPIOs. Not sure how to set this as solved.

View solution in original post

0 Kudos
1 Reply
332 Views
endrunner_smw
Contributor III

I'll leave this up in case anyone runs into the same issue.

Long story short, I was not byte swapping correctly. I was taking the full 32bit value and reversing it, instead of reversing each 8 bit block within that 32bit value.

Learn from my mistake and have fun with those GPIOs. Not sure how to set this as solved.

0 Kudos