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.

CCS/TMS320F28335: Re configuring a GPIO Port

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hi,

I understand that there are basically three GPIO ports available: GPA, GPB and GPC in F28335. These are configured in the GPIO.H file with sequential assignments of GPIO pins to ports

I wanted to know if I can play around with the file to re-arrange the pins of a port (for e.g. pin sequence in GPA port may go something like: GPIO 0, GPIO 3, GPIO 1, GPIO 4 ... or any other combination/sequence) so that when I write data to the port, it is distributed onto the pins in a special arrangement?

Further, is it possible to re-define the ports from 32-bit to 16-bit or even 8-bit size and hence increase the number of available ports?

Regards,

Muhammad Subhani

  • No, there isn't a way to rearrange the pins like that. The closest you could get would be to write a layer of software that changes the bit order before performing the actual register write--but that would be more of a function than an edit to the header file.

    Regarding your second question, you could do that to some degree--if you wanted to rewrite the structures in the header file to alias 32-bit GPA to be two 16-bit ports named totally different things, you can do that. As long as the register addresses and bit positions are aligned properly when the application is built and linked, there shouldn't be a problem. 8 bits might be a little tricky since the C28x doesn't have an 8-bit datatype, but you could probably use bit fields and unions to come up with something to that effect.

    Whitney

  • Dear Whitney,

    Thank you for the quick reply. I think I know what to do now.

    Just one more thing, what does this operator do ':' ?

    for example: 

    struct GPACTRL_BITS {         // bits   description
        Uint16 QUALPRD0:8;        // 7:0    Qual period
        Uint16 QUALPRD1:8;        // 15:8   Qual period
        Uint16 QUALPRD2:8;        // 23:16  Qual period
        Uint16 QUALPRD3:8;        // 31:24  Qual period
    };

    is it used to define/distribute/allocate memory within the structure?

    Regards,

  • It's saying that that struct member should take up that number of bits--so essentially GPACTRL_BITS represents a 32-bit register made up of four 8-bit fields. If you do a web search for something like "bit fields in C programming," you can get more information about it.

    Whitney

  • Dear Whitney,

    Many thanks for your help in both replies. As per your suggestion, I successfully managed to re-write the GPIO.H and GPIO.c files and re configure port A as two separate ports A1 and A2.

    Once again, many thanks.