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.

컴파일러 / TMS320F28377D : SPI-A MOSI signal output is not working.

Part Number: TMS320F28377D
Other Parts Discussed in Thread: ADS8688, , C2000WARE

Tool/software: TI C/C++ Compiler

1. The 28377D has MOSI transmitting MSB first, Then should the LSB bit be converted so that it can be transmitted first in 28377D?

2. SPI MOSI Signal not~~~!

   The SPI settings are as follows.

   SPI -A GPIO setting.

    EALLOW;

GpioCtrlRegs.GPAGMUX2.bit.GPIO16 = 0x0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO17 = 0x0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0x0;
GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0x0;

GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0x1; // MOSI
GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0x1; // MISO
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 0x1; // CLK
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0x0; // Chip Select

GpioCtrlRegs.GPAPUD.all &= 0xFCB8FFFF;
GpioCtrlRegs.GPAQSEL2.all |= 0x000F303F;

GpioCtrlRegs.GPADIR.bit.GPIO19 = 1;

EDIS;

SPI -A Regs Setting

EALLOW;

SpiaRegs.SPICCR.bit.SPISWRESET = 0;
SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
SpiaRegs.SPICCR.bit.CLKPOLARITY = 1;
SpiaRegs.SPICTL.bit.CLK_PHASE = 1;
SpiaRegs.SPIBRR.all = 7;
SpiaRegs.SPICCR.bit.SPICHAR = 0x7;
SpiaRegs.SPISTS.bit.OVERRUN_FLAG = 0;
SpiaRegs.SPISTS.bit.INT_FLAG = 0;
SpiaRegs.SPISTS.bit.BUFFULL_FLAG = 0;
SpiaRegs.SPICCR.bit.SPISWRESET=1;

GpioCtrlRegs.GPADIR.bit.GPIO19 = 1;

EDIS;

The code for sending data is as follows.

GpioDataRegs.GPACLEAR.bit.GPIO19 = 1;

while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG ==1){}

SpiaRegs.SPITXBUF = Send_Sdata << 8 ;

while(SpiaRegs.SPISTS.bit.INT_FLAG !=1){}

nDataSpi = SpiaRegs.SPIRXBUF;

GpioDataRegs.GPASET.bit.GPIO19 = 1;

ret = nDataSpi;
return ret;

28377D and ADS8688 are connected via ISO7141.

SPI CLK:12.5MHz

3. From the MOSI of SPI A, the waveform shown is output.Why is the waveform shown in the picture printed?

   The same waveform was measured when the waveform was measured after removing the iSO7141 chip.

  • falconjjang said:

    Part Number: TMS320F28377D

    Tool/software: TI C/C++ Compiler

    1. The 28377D has MOSI transmitting MSB first, Then should the LSB bit be converted so that it can be transmitted first in 28377D?

    2. SPI MOSI Signal not~~~!

       The SPI settings are as follows.

       SPI -A GPIO setting.

        EALLOW;

    GpioCtrlRegs.GPAGMUX2.bit.GPIO16 = 0x0;
    GpioCtrlRegs.GPAGMUX2.bit.GPIO17 = 0x0;
    GpioCtrlRegs.GPAGMUX2.bit.GPIO18 = 0x0;
    GpioCtrlRegs.GPAGMUX2.bit.GPIO19 = 0x0;

    GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 0x1; // MOSI
    GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 0x1; // MISO
    GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 0x1; // CLK
    GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0x0; // Chip Select

    GpioCtrlRegs.GPAPUD.all &= 0xFCB8FFFF;
    GpioCtrlRegs.GPAQSEL2.all |= 0x000F303F;

    GpioCtrlRegs.GPADIR.bit.GPIO19 = 1;

    EDIS;

    SPI -A Regs Setting

    EALLOW;

    SpiaRegs.SPICCR.bit.SPISWRESET = 0;
    SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
    SpiaRegs.SPICCR.bit.CLKPOLARITY = 1;
    SpiaRegs.SPICTL.bit.CLK_PHASE = 1;
    SpiaRegs.SPIBRR.all = 7;
    SpiaRegs.SPICCR.bit.SPICHAR = 0x7;
    SpiaRegs.SPISTS.bit.OVERRUN_FLAG = 0;
    SpiaRegs.SPISTS.bit.INT_FLAG = 0;
    SpiaRegs.SPISTS.bit.BUFFULL_FLAG = 0;
    SpiaRegs.SPICCR.bit.SPISWRESET=1;

    GpioCtrlRegs.GPADIR.bit.GPIO19 = 1;

    EDIS;

    The code for sending data is as follows.

    GpioDataRegs.GPACLEAR.bit.GPIO19 = 1;

    while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG ==1){}

    SpiaRegs.SPITXBUF = Send_Sdata << 8 ;

    while(SpiaRegs.SPISTS.bit.INT_FLAG !=1){}

    nDataSpi = SpiaRegs.SPIRXBUF;

    GpioDataRegs.GPASET.bit.GPIO19 = 1;

    ret = nDataSpi;
    return ret;

    28377D and ADS8688 are connected via ISO7141.

    SPI CLK:12.5MHz

    3. From the MOSI of SPI A, the waveform shown is output.Why is the waveform shown in the picture printed?

       The same waveform was measured when the waveform was measured after removing the iSO7141 chip.

  • Hi,

    falconjjang said:
    1. The 28377D has MOSI transmitting MSB first, Then should the LSB bit be converted so that it can be transmitted first in 28377D?

    I'm not sure I understand your question. Are you trying to change the endianess of the data being shifted out?

    falconjjang said:
    2. SPI MOSI Signal not~~~!

    falconjjang said:
    3. From the MOSI of SPI A, the waveform shown is output.Why is the waveform shown in the picture printed?

    You pinmux config and SPI config looks correct. Can you can refer to any of the SPI examples in C2000ware? 

    <c2000ware_install_directory>\device_support\f2837xd\examples\cpu1

  • The example source code is normal for MOSI output.

    But I want to use non FIFO mode.

    MOSI signal does not come out when bold part is executed in the attached code.

    Delete the bold part and then "void InitSpi(void)"
    If you run "SpiaRegs.SPICTL.bit.TALK = 1", MOSI  signal  output and MISO signal is not output.

    When using GPIO16 ~GPIO19 SPI Port, is it affected by "MOSI" or "MISO" port if Channel is selected as GPIO?

    Is there normal(non FIFO mode) mode example code or References manual? 

    GpioDataRegs.GPACLEAR.bit.GPIO19 = 1;

    while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG ==1){}

    SpiaRegs.SPITXBUF = Send_Sdata << 8 ;

    while(SpiaRegs.SPISTS.bit.INT_FLAG !=1){}

    nDataSpi = SpiaRegs.SPIRXBUF;

    GpioDataRegs.GPASET.bit.GPIO19 = 1;

  • Hi,

    falconjjang said:
    The example source code is normal for MOSI output.

    Yes, it is.

    falconjjang said:
    But I want to use non FIFO mode.

    OK, understood. However, if you use the code as is though, so you see the MOSI pin toggling?

    falconjjang said:
    Delete the bold part and then "void InitSpi(void)"

    I'm sorry, I don't understand. Delete what code?

    falconjjang said:
    If you run "SpiaRegs.SPICTL.bit.TALK = 1", MOSI  signal  output and MISO signal is not output.

    In your case, SPIA is configured as a master. In this case, if TALK=1, the SPI MOSI pin will be enabled. If TALK=0, the MOSI pin will be disabled. The TALK bit doesn't affect the operation of the MISO pin, that pin is driven by the slave device (ADC).

    falconjjang said:
    When using GPIO16 ~GPIO19 SPI Port, is it affected by "MOSI" or "MISO" port if Channel is selected as GPIO?

    I don't understand your question. GPIO16, GPIO17, GPIO18 must be configured as SPI pins. GPIO19 can be configured as SPISTEA or GPIO, it's your choice.

    falconjjang said:
    Is there normal(non FIFO mode) mode example code or References manual? 

    No, there isn't. However, the FIFO mode does not enable or disable MOSI pin transmission.

  • After "c2000ware" & ccsstudio reinstall, the problem was solved.

    I do not know the cause.

    I don't know why the MISO signal does not come out when the MOSI signal is output, and the MOSI signal is not output when the MISO signal is output.

    is TALK a bit that must be set? Please explain the talk bit in detail.

    If there is an AD convert or DA convert source available, please email us.

    Thanks for Gus Martinez answer.

  • Glad to hear the issue was resolved.

    falconjjang said:
    is TALK a bit that must be set? Please explain the talk bit in detail.

    The TALK bit is explained in the technical reference manual, but the diagram below shows it well. If TALK=1, the data from the SPIDAT register is driven on the SPISIMO pin. If TALK=0, the data is not driven on the SPISIMO pin.