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.

PROCESSOR-SDK-J721S2: MCU_SPI1 chip select signal never pulls high

Part Number: PROCESSOR-SDK-J721S2

Hi team,

When debugging MCU_SPI1 on J721S2, the chip select clock cannot be pulled high. The transmitted data waveform can be detected on MOSI, but the data cannot be received properly.

Customer follows Section 5.5.23.2 of TRM and write the MCU_SPI1_CTRL[SPI1_LINKDIS], MCU_SPI1_CLKSEL[MSTR_lb_CLKSEL], and SPI3_CLKSEL[MSTR_lb_CLKSEL] registers to 1. But MCU_SPI 1 chip select still cannot be pulled low. How to set it up with MCU_SPI1 to work properly standalone, not affected by SPI3? 

The code to write these 3 registers is as follows:

CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_LOCK0_KICK0, 0x68EF3490);
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_LOCK0_KICK1,0xD172BC5A);
regVal = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_LOCK0_KICK0);
while ((regVal & 0x1) != 0x1U)
{
regVal = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_LOCK0_KICK0);
}

/* Enable MCU_MCSPI1 and MCSPI3 independently pin out */
CSL_REG32_WR(CSL_MCU_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_MCU_SPI1_CTRL, CSL_MCU_CTRL_MMR_CFG0_MCU_SPI1_CTRL_SPI1_LINKDIS_MASK);
regVal = CSL_REG32_RD(CSL_MCU_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_MCU_SPI1_CTRL);
AppUtils_Printf(APP_UTILS_PRINT_MSG_NORMAL,
APP_NAME ": Reg111 %d\n",
regVal);

CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_MCU_TIMER5_CLKSEL + 16 ,1U);     
regVal1 = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + CSL_MCU_CTRL_MMR_CFG0_MCU_TIMER5_CLKSEL + 16 );         
AppUtils_Printf(APP_UTILS_PRINT_MSG_NORMAL,
APP_NAME ": Reg222 %d\n",
regVal1);

CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + CSL_MAIN_CTRL_MMR_CFG0_SPI3_CLKSEL + 16 ,1U);
regVal2 = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + CSL_MAIN_CTRL_MMR_CFG0_SPI3_CLKSEL + 16 );

AppUtils_Printf(APP_UTILS_PRINT_MSG_NORMAL,
APP_NAME ": Reg333 %d\n",
regVal2);

Only the MCU_SPI1_CTRL[SPI1_LINKDIS] register reads 1. The two registers MCU_SPI1_CLKSEL[MSTR_lb_CLKSEL], and SPI3_CLKSEL[MSTR_lb_CLKSEL] always read 0. 

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    We just need to break the connection between mcu_spi1 and Main_McSPI3 and this is done by setting CTRLMMR_MCU_SPI1_CTRL[0] SPI1_LINKDIS register field to 1. 

    Additionally can you please make sure that pinmux is setup correct for CS pin? It is not possible to send data out without CS pin toggling in SPI. So there must be something missing in configuring CS pin.. 

    Regards,

    Brijesh

  • I have written CTRLMMR_MCU_SPI1_CTRL[0] SPI1_LINKDIS register as 1 in the software, and I can read the value of this register and print it out, which is indeed 1. Besides, I have configured it by pinmux according to the chip manual。 

    Here is my pinmux:

    I don't know what the problem is, MCU_SPI1 piece selection signal can not automatically pull up and down

  • Now the MOSI and CLK signals of MCU_SPI1 are normal, and the slice selection signals are always abnormal. Cause project card delay, can you reply as soon as possible how to set the next film selection to normal control?

  • Hello,

    we have an example at mcal/examples/Spi/mcspi_app/soc/j721s2/mcu1_0/McspiApp_Startup.c. In  

    SpiApp_Startup API you can see the pin muxing . Please verify with it.
    Regards
    Tarun Mukesh
  • So in addition to need to/j721s2_ECO_08_06 / ti - processor - SDK - rtos - j721s2 - evm entry - 08 _06_00_11 / pdk_j721s2_08_06_00_31 / packages/ti/board/SRC/j721s 2_evm/J721S2_pinmux.h and /j721s2_ECO_08_06/ ti-processor-SDk-TOS -j721s2-evm-08_06_00_11/pdk_j721s2_08_06_00_31/packages/ti/ If pin multiplexing of MCU_SPI1 is set in board/src/j721s2_evm/J721S2_pinmux_data.c, pin multiplexing of MCU_SPI1 needs to be set in McspiAPP_Startup.c.   In Mcspi_APP.c the example uses the internal loopback mode of the pin setting, while I'm going to use D1 for sending and D0 for receiving. All 4 pins of SPI regVal, what should I set to each

  • Hello,

    So in addition to need to/j721s2_ECO_08_06 / ti - processor - SDK - rtos - j721s2 - evm entry - 08 _06_00_11 / pdk_j721s2_08_06_00_31 / packages/ti/board/SRC/j721s 2_evm/J721S2_pinmux.h and /j721s2_ECO_08_06/ ti-processor-SDk-TOS -j721s2-evm-08_06_00_11/pdk_j721s2_08_06_00_31/packages/ti/ If pin multiplexing of MCU_SPI1 is set in board/src/j721s2_evm/J721S2_pinmux_data.c, pin multiplexing of MCU_SPI1 needs to be set in McspiAPP_Startup.c

    No as you are using PDK SPI driver, not need to do the changes in McspiAPP_Startup.c .

    The code to write these 3 registers is as follows:

    I am suggesting an example of pin muxing MCU_SPI1 written in MCAL SPI driver examples to consider while writing into registers.

    /* MCU MCSPI 1 CS0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU);
    regVal &= 0x40001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU, regVal);

    /* MCU MCSPI 1 D1 PAD configuration*/
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C8U);
    regVal &= 0x00001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C8U, regVal);

    /* MCU MCSPI 1 D0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U);
    regVal &= 0x240001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U, regVal);

    /* MCU MCSPI 1 CLK PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U);
    regVal &= 0x40001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U, regVal);

    Can you check this out ?

    Based on Tx and RX the following bits need to be set accordingly.

    Regards

    Tarun Mukesh

  • Hi ,

    I write register in the code and in J721S2_pinmux.h J721S2_pinmux_date.c directly write pin multiplexing, the effect is the same. MCU_SPI0 I am also in J721S2_pinmux.h and J721S2_pinmux_date.c write foot multiplexing. There is no other register to write it to. MCU_SPI0 works properly. My understanding is that the decoupling register of MCU_SPI1 was successfully written. pinmux is set up as in the manual. MCU_SPI1 should be able to send data normally. The data received by MCU_SPI1 is always the data sent, except that the slice selection signal cannot be controlled. Does it have anything to do with the setup? I'm using MCU_SPI in RTOS.

  • Hello,

    No MCU_SPI1 doesn't have any extra steps other than the decoupling register.

    The data received by MCU_SPI1 is always the data sent,

    Is this the expectation or it is happening as fault ?

    Have you tried writing the values into the registers as mentioned above in the place of your code ?

    Regards

    Tarun

  • Hello,

    If the above doesn't work out can you do as below?

    /* MCU MCSPI 1 CS0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU);
    regVal &= 0xFFDBFFF1U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU, regVal);

    /* MCU MCSPI 1 D1 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C8U);
    regVal &= 0xFFDBFFF1U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C8U, regVal);

    /* MCU MCSPI 1 D0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U);
    regVal &= 0xFFFFFFF1U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U, regVal);

    /* MCU MCSPI 1 CLK PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U);
    regVal &= 0xFFDFFFF1U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U, regVal);

    Regards

    Tarun

  • I added this piece of write register and pin multiplexing to the SPI initialization code, and the slice selection signal still doesn't automatically pull up and down

  • /* MCU MCSPI 1 CS0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU);
    regVal &= 0x40001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU, regVal);

    /* MCU MCSPI 1 D1 PAD configuration*/
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C8U);
    regVal &= 0x00001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C8U, regVal);

    /* MCU MCSPI 1 D0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U);
    regVal &= 0x240001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U, regVal);

    /* MCU MCSPI 1 CLK PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U);
    regVal &= 0x40001U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U, regVal);

    Can you try this out as well?

    Is there any external PULLUP/PULLDOWN connected to the CS Pin from slave side?

    Can you confirm you are using TI EVM?

    Regards

    Tarun Mukesh

  • The selection signal still doesn't automatically pull up and down.    

    pdk version :ti-processor-sdk-rtos-j721s2-evm-08_06_00_11

    J721S2_ECO board.   

    The slave cannot control the chip selection signal。

  • That's strange .

    J721S2_ECO board.   

    No the SOM, i am asking about Processor Board is it TI EVM or Custom Board?

    The slave cannot control the chip selection signal。

    In the hardware any external PULLUP/PULLDOWN connected is what i am asking ?

    Regards

    Tarun Mukesh

  • Is this the expectation or it is happening as fault ?

    Can you answer this as well ? Are you trying loop back test ? 

  • The film selection signal is hardwired directly from the MCU to the slave。  Board is our own design of the board, based on J721S2_EVM.

  • Receiving data consistent with sending data is not what we expect. I am using MCU_SPI 1 to communicate with the slave. The loopback mode function is turned off.

  • Hello,

    I didn't exactly understand here, the MCU_SPI is sending data and slave receiving is not matching is what you are saying ?

    Regards

    Tarun Mukesh

  • The data received by MCU_SPI1 is always the data sent, except that the slice selection signal cannot be controlled.

    If chip select has issue , the data will not be sent./received .

    Can you please illustrate with picture/diagram here  ?

    Regards

    Tarun Mukesh

  • I sent data to read the version number of slave machine, and the MOSI signal was parsed out to be the data I sent, which proved that SPI was sent successfully. But the data I received (i.e. MISO signal parsing data) was still the data I sent, not the slave version number. I don't know why the data MISO receives is always same as my MOSI sent.

  • Hello,

    Can you share the register dump at PAD config addresses for both MCU_SPI0(when its working) and MCU_SPI1 CS ,D1,D0 and CLK ?

    Is MCU_SPI1 being used in single channel master mode  or multiple channel mode ?

    Regards

    Tarun Mukesh

  • For MCU_SPI0 I configured pin multiplexing directly in pinmux, without addressing it in the code. Its function is used normally.

    MCU_SPI1 used single-channel mode。

  • The level of MCU_SPI1 selected signal is always high when SPI is not initialized and no data is sent. After the initial SPI configuration, the slice selection signal level is low regardless of whether data is sent or not.

  • Hi,

    Can i get the values written in PAD addresses  for both MCU_SPI0 and MCU_SPI1?

    For Example MCU_SPI1_CS0  PAD we wrote the value in 0x4301C0CC Address

    /* MCU MCSPI 1 CS0 PAD configuration */
    regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU);
    regVal &= 0xFFDBFFF1U;
    CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0CCU, regVal);

    Print the value at address  0x4301C0CC 

    and also print the value of decoupling register as well.

    Regards

    Tarun Mukesh

  • The same configuration is working for MCU_SPI0 and not working for MCU_SPI1?

    Can you try for Mux Mode =0 for MCU_SPI1 as well as we can use both Mux Mode =0 or Mux Mode =1 for CS,CLK,D0 and D1 ?

    Honestly other than this there are no other registers which effects MCU_SPI1 , there might be an issue in hardware .Because SPI0 working with same configuration and SPI1 not working might not be an issue from SW side

    Regards

    Tarun Mukesh

  • I have tried this, the multiplexing mode of 1 and 0 does not properly control the SPI slice selection signal

  • MCU_SPI1 used single-channel mode。

    Can you please keep break points at 

    McSPICSAssert() and McSPICSDeAssert() API check whether both are being hit or not ?
    Are you using in Polling mode or interrupt mode ?
    Regards
    Tarun Mukesh
  • I use serial print debugging, hit the breakpoint. I use the polling mode

  • I use serial print debugging, hit the breakpoint.

    Sorry . Can you use CCS and check whether the McSPICSAssert() and McSPICSDeAssert() API's are being addressed in polling mode ? and FORCE bit being toggled or not in the corresponding register

    This bit ensures to turn the CS status from active to inactive and vice versa

    Regards

    Tarun Mukesh

  • We can't use CCS debugging, the XDS110 debugger we bought from TI won't work. TI doesn't have aftermarket support for this CCS anymore.

  • ok.

    Can you share me the log by keeping the print in McSPICSAssert() and McSPICSDeAssert() API's ?

    Initially the CS is high and Assert API makes it to low after that DeAssert API ensures it turning high back.

    Regards

    Tarun Mukesh

  • Initially, I set.cspin to SpiConf_SpiExternalDevice_CS1, and just now I set.cspin to SpiConf_SpiExternalDevice_CS0. Now MCU_SPI1's slice selection signal can be pulled up and down.  In theory, should.cspin of MCU_SPI0 be set to SpiConf_SpiExternalDevice_CS0 and.cspin of MCU_SPI1 be set to SpiConf_SpiExternalDevice_CS1?

  • If you are using CS0 then you need to put  SpiConf_SpiExternalDevice_CS0 it may be MCU_SPI0/1 .

    /* MCU MCSPI 1 CS0 PAD configuration */

    You are configuring CS0 PAD so you have to use SpiConf_SpiExternalDevice_CS0.

    If you want to configure CS1 you have to set PAD accordingly.

    Regards

    Tarun Mukesh

  • Thanks, MCU_SPI 1 works fine after I configured this to CS0.