How do I toggle ls1012a GPIO via bare-metal application?

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

How do I toggle ls1012a GPIO via bare-metal application?

936 Views
timhammer
Contributor III

I am attempting to bring up a custom board based on the ls1012a Freedom reference design. It seems that I have succeeded in connecting my CodeWarrior TAP and writing the RCW/PBI and U-Boot binary images via cwflash.py (there are no errors reported; implication is that RCW was written as I can now connect via the TAP with USE_SAFE_RCW = False). However, there is no indication on the UART that U-Boot is coming up.

I am able to run the Bare Metal "Hello World" example program through the CodeWarrior IDE and TAP- although when I switch the output to use the UART (.../lib/uart.specs vs. .../lib/simrdimon.specs) I do not get any output. I am able to get the output on my Freedom reference board as expected.

I figured I would fall back to some basic GPIO toggling to try and test out some basics. I thought I understood all the information I needed, but now am not so sure.

The hard-coded (SAFE) RCW has the field UART1_BASE (bits 368-369) set to 00 (I think; Table 4-11 in section 4.4.5.3 of the reference manual), so that means the pins should be accessible as GPIO1[0] and GPIO1[1].

The GPIO1 registers are at 0x0230_0000 according to the CCSR address map (Table 2-2 in section 2.3 of the reference manual) (the reference manual is a little confusing- on page 189 it says "table lists the block base address assigned to each block from the base of the 240 MB CCSR space"; this could mean that that address in the table is to be added to the CCSR base (0x0100_0000), but the first address in the table is 0x0100_0000, indicating it might already be an "absolute" address; besides, when I try using 0x0330_0000 for GPIO1 registers, the program throws an exception...).

I can set bits high at the direction register address (offset 0 (0x0230_0000)) and can see that my changes "stick" (i.e. looking at that address later I see the bits I set high are still high). However, when setting/clearing the corresponding bits at the data register (offset 8 (0x0230_0008)) I am not experiencing changes at the outputs.

I am unclear what is meant by the function description concerning reading the data register (in output mode read returns "data at pin"; in input mode read returns "state of the port"; reference manual section 20.5.4.4). Does this mean that in output mode the read will return the value last "written" to the bit whereas in input mode the read will return the value actually seen on the pin?

The GPIO1 (and GPIO2) descriptions in the CCSR table indicate that byte-swapping is required for these registers. I have tried working with GPIO1[0] and GPIO1[1] as bits 0 & 1 as well as bits 24 & 25. Both options behave as above. Am I not byte-swapping correctly? Should it be something other than bits 24 & 25?

Any thoughts or ideas would be greatly appreciated.

.Tim

Labels (1)
Tags (1)
0 Kudos
2 Replies

703 Views
Pavel
NXP Employee
NXP Employee
  1. If the RCW[UART1_BASE] bits are set to 0b00. the UART1_SOUT and UART1_SIN signals are assigned to GPIO1[0] and GPIO1[1]. See the Table 3-10 of the LS1012a Reference Manual.

 

  1. The start address of the CCSR register space is 0x100_0000. See the Table 2-1 of the LS1012a Reference Manual.

 

  1. The start address of the GPIO1 is 0x230_0000. It is not offset. It is Start address. See the Table 2-2 of the LS1012a Reference Manual.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

703 Views
timhammer
Contributor III

Pavel -

Thank you for the clarifications of the RCW, registers, and addresses. However, I am still experiencing the issue of not seeing any changes on the pins.

am unclear what is meant by the function description concerning reading the data register (in output mode read returns "data at pin"; in input mode read returns "state of the port"; reference manual section 20.5.4.4). Does this mean that in output mode the read will return the value last "written" to the bit whereas in input mode the read will return the value actually seen on the pin?

 

The GPIO1 (and GPIO2) descriptions in the CCSR table indicate that byte-swapping is required for these registers. I have tried working with GPIO1[0] and GPIO1[1] as bits 0 & 1 as well as bits 24 & 25. Neither option results in changes on the pins. Am I not byte-swapping correctly? Should it be something other than bits 24 & 25?

Any additional thoughts or ideas would be greatly appreciated.

.Tim

0 Kudos