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.

TMS320F28379S: tms320f28379s

Part Number: TMS320F28379S

In the function, Endat_setup_GPIO, I see below lines of code.

"

GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 1; // Configure GPIO6 as EnDat Clk master

GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 1; // Configure GPIO7 as SPI Clk slave

GpioCtrlRegs.GPAGMUX2.bit.GPIO24 = 1;

GpioCtrlRegs.GPAGMUX2.bit.GPIO25 = 1;

GpioCtrlRegs.GPAGMUX2.bit.GPIO26 = 1;

GpioCtrlRegs.GPAGMUX2.bit.GPIO27 = 1;

GpioCtrlRegs.GPAMUX2.bit.GPIO24 = 2; // Configure GPIO24 as SPISIMOB

GpioCtrlRegs.GPAMUX2.bit.GPIO25 = 2; // Configure GPIO25 as SPISOMIB

GpioCtrlRegs.GPAMUX2.bit.GPIO26 = 2; // Configure GPIO26 as SPICLKB

GpioCtrlRegs.GPAMUX2.bit.GPIO27 = 2; // Configure GPIO27 as SPISTEB

"

What does the value 1 and 2 mean? Why are we writing a 1 and then 2 to GpioCtrlRegs.GPAMUX2.bit.GPIO24? Not clear from the data sheet. Can you explain?

Regards,

Akila

  • Akila,

    By default all the pins are configured as GPIO function. To enable SPI function on a pin you need to change the pinmux setting. To change the pinmux setting one need to configure GPxMUXy register and in some cases GPxGMUXy register as well. That is what this code is doing.
    Please refer "Table 4-3. GPIO Muxed Pins" in device manual for more detail.

    Regards,
    Vivek Singh
  • Thanks.

    I still don't understand these lines.
    GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 1; // Configure GPIO6 as EnDat Clk master

    GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 1; // Configure GPIO7 as SPI Clk slave

    According to table 4-3, it is being configured to EPWM4A (O) and EPWM4B (O). The comment says they are configured as master and slave. Can you explain?

    Akila
  • Aklila,

    Your understanding is correct - In the EnDat application library, the outputs are set to PWM mode, but these are controlled by Configurable Logic Block (CLB) via library functions.