This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unable to write into GPIO registers

Other Parts Discussed in Thread: HALCOGEN

hi

I am using following code but unable to write into GPIO register. Code compiles well but doesnt write into GPIO registers.

 

ldr R12, PORTBASE

 mov R1, #0x1

str R1, [R12, #0]

ldr R11, PORTADDRESS

mov R2, #0xFF

str R1, [R11, #0]

ldr R6, [R12, #4]

 

PORTADDRESS            .word 0xFFF7BC34

PORTBASE                         .word 0xFFF7BC00

 

REgards

Chitra

  • Hi Chitra,

    I am adding comments to your code below.

    ldr R12, PORTBASE             ; r12 = 0xfff7bc00, the address for GIOGCR0 register
    mov R1, #0x1
    str R1, [R12, #0]                    ; write 0x1 to GIOGCR0, releasing GIO module from reset
    
    ldr R11, PORTADDRESS   ; r11 = 0xfff7bc34, address for GIODIRA
    mov R2, #0xFF
    
    str R1, [R11, #0]                   ; write 0x1 to GIODIR, making GIOA[0] as output
    ldr R6, [R12, #4]                   ; read from GIOINTDET register
    
    PORTADDRESS      .word 0xFFF7BC34
    PORTBASE         .word 0xFFF7BC00

    How do you determine that the writes are not successful? Please note that you do need to release the peripheral reset from the system module CLKCNTL register as well. This is done by setting the PENA (Peripheral Enable) bit before you write to the GIO register frame. You also need to enable clock to the GIO module by clearing the corresponding peripheral power down bit in the PCR (Peripheral Central Resource) controller module.

    The system and PCR module setup would be done automatically for you if you use HALCoGen to generate the initialization sequence.

    Regards, Sunil