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.

Should the GPIO data regs accessed only by 32 bit instruction?



Hello

The GPIO DAT, SET, CLEAR and TOGGLE registers are 32 bit size. But is it possible for me address them as two 16 bit registers. Say, I am trying to clear two bits in the high word and so my data would be 0x03000000. But only a 16 bit MOV instruction with immediate value is there and not a 32 bit.

If I code as below, is it ok (both in terms of accessing the register, getting the right work done and writing to the right location)

  MOVW DP, #_GpioDataRegs

  MOV   @_GpioDataRegs.GPIOCLEAR.all +1, #0x0300

If there is any better suggestion, please pass on. I want to do only "immediate" to reduce the instruction count to just 1.

Thanks

Sayee

  • The F28x Header Files and Peripheral examples package has examples in C that configure GPIO pins.  There is a "GPIO toggle" example that set/clear/toggle the pins.  You could take a look at the assembly code generated by the compiler for this example  to get an idea of which instructions are used. This related post might also be of interest.

  • I use the following code snipet for debugging all of the time and it works perfectly.

    ;--- TOGGLE THE GPIO_32_DEBUG_0 PIN AS AUTO ZERO MARKER

     

     

     

    MOVZ DP, #DP_GPIO
    MOV @
    GPBTOGGLEL, #GPIO_32_DEBUG_0
    NOP

    NOP
    MOV @GPBTOGGLEL, #GPIO_32_DEBUG_0

    I have the following lines in my processor definition file

    GPBTOGGLE

    .set 0x6FCE ; GPIO B Toggle Register (32-34)
    GPBTOGGLEL .set 0x6FCE
    ; GPIO B Toggle Register (32-34) Low Word
    GPBTOGGLEH .set 0x6FCF
    ; GPIO B Toggle Register (UNUSED) High Word

    As you can see, you can access the entire GPBTOGGLE register with a 32 bit instruction or I use the L or H definition to remind myself that I am using a 16 bit access method.

    So your instructions should work as you intend.Allen