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.

F28337- GPIO Configuration.

Hi all.

after seeing dozens of Control Suite examples i still dont understand what is the right way to configure the GPIO's?

for example, i need to write a code that uses SPI and SCI modules.

the SCI doesnt have any extra GPIO configurations but the SPI pins needs more configurations, to be Inputs or outputs and enables internal pull ups Etc...

so what is the right way to config those GPIO's?

another example is that i write a code that uses timer0 interrupt that toggles one of the GPIO every 50 msec.

i config the GPIO to be Push-Pull and Output and hoped to see a sqaure wave in a scope, but it didnt work.

so i figured that my code is wrong, so i changed the GPIO to 34 (the one that connected to the LED in the Control Card) and it worked.

so my next step was to check the GPIO Toggle example (i ran it and it worked) but when i tried to change my code to be similar to the example it still didnt work.

so bottom line, ill be glad if someone can write to me what are the correct stages to configure the GPIO's.

best regards

Shimon Otsri

  • Shimon,

    To connect a GPIO pin to a peripheral, you need to set the bits in the mux registers (GPAMUX1/2, GPBMUX1/2, and GPCMUX1/2). For example, to connect SPISIMOA to GPIO54, set bits 13:12 of GPBMUX2 to 01. For peripheral inputs, you should also set the GPIO qualification mode to asynchronous. In our example, set bits 13:32 of GPBQSEL2 to 11. You don't need to change the direction. You can enable pull-ups if the pins might be disconnected from the serial bus.


    The SPI examples are using loopback mode. In loopback mode, the SIMO and SOMI signals are connected inside the SPI module, so the GPIO pins are not needed. The SCI examples talk to the outside world, so they set up the GPIOs. You can find GPIO configuration code for both peripherals in DSP2833x_Spi.c and DSP2833x_Sci.c, respectively.

  • Adam thank you for your reply.

    i understand the logic you explained to me.
    so if i want to configure GPIO 51 (for example) to be a output GPIO, so i need to write 0x00 to the GPxMUX1/2 relevant bits and thats it?
    in some examples (among them the SCI example) you called for two functions from the GPIO C file.
    so i need to call this functions in addition to the GPxMUX1/2?
  • To configure a pin to be a GPIO output, you have to write 00 to the appropriate bits in GPxMUX1/2, then write a 1 to the appropriate bit in GPxDIR.

    Which function calls are you referring to? I don't see any GPIO function calls in sci_autobaud or sci_echoback.

  • Oh, I understand now -- the title of your post says F28337, but your tag is for the F28377. Those are different MCUs. :-)

    The F28x7x devices have an expanded GPIO mux. You have to write both GPxMUX1/2 and GPxGMUX1/2 (four bits total per IO). The call to GPIO_SetupPinMux() sets the GPxMUX1/2 and GPyGMUX1/2 register bits. GPIO_SetupPinOptions() is for setting the direction and configuration of GPIOs -- input qualification, input inversion, open drain output, and internal pull-ups.

    The SCI example should be setting the input qualification to asynchronous, but it is not. I will send a bug report to our software team. The correct function call for the input should be:

    GPIO_SetupPinOptions(29, GPIO_OUTPUT, GPIO_ASYNC);

    The output pin does not need any pin options. The peripheral automatically determines the direction.

    Section 7.1 of the TRM (literature number SPRUHM8) has a block diagram showing the GPIO pin and peripheral muxing.
  • Sorry for the mistake, i meant to F28377.

    now i understand.

    thank you Adam!