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.

RTOS/AWR1642BOOST: SPI slave transaction aborts execution

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: AWR1642, SYSBIOS

Tool/software: TI-RTOS

I'm trying to implement SPI communication on the Traffic Monitoring lab. I achieved successful communication with Master mode, but when I configure Slave mode and  I run SPI_transfer(), I get the following command lines:

{module#8}: "../dss_main.c", line 212: error {id:0x10000, args:[0x814364, 0x814364]}
[Cortex_R4_0] xdc.runtime.Main: "platform/mmwave_xwr16xx.c", line 1342: assertion failure
xdc.runtime.Error.raise: terminating execution

My configuration code for the SPI driver is:

SPI_Params_init(&params);

    params.mode = SPI_SLAVE;
    params.frameFormat = SPI_POL0_PHA0;
    params.pinMode = SPI_PINMODE_4PIN_CS;
    params.shiftFormat = SPI_MSB_FIRST;
    params.dmaEnable = 1;
    params.dmaHandle = dmaHandle;
    params.u.slaveParams.dmaCfg.txDmaChanNum =1U;
    params.u.slaveParams.dmaCfg.rxDmaChanNum =0U;
    params.transferMode = SPI_MODE_BLOCKING;
    params.dataSize = 8U;
    params.u.slaveParams.chipSelect=0;

My code to call the transaction function is:

     uint16_t a = 2;
        char r;
        SPI_Transaction spiTransaction;
        spiTransaction.count = sizeof(uint16_t);   //COUNT= number of frames for this transaction
        spiTransaction.txBuf = (void *)&a;   //void * to a buffer with data to be transmitted
        spiTransaction.rxBuf = NULL;        //receive
        spiTransaction.slaveIndex=0;

        int ret = SPI_transfer(SPIhandle, &spiTransaction); //llamo a la funcion
        if (!ret) {
            System_printf("Unsuccessful SPI transfer");
        }

I've already checked the SPI test files in the driver folder and got no information for this problem. Could you help me solving it?

  • Debugging, I've noticed that it crashes when it reaches

    MIBSPI_dataTransfer(ptrMibSpiDriver, transaction->txBuf, transaction->rxBuf, dataLength, transaction->slaveIndex);

    line 2267 on mibspi_dma.c

    it seems that it gets stuck in a semaphore_pend function.

    I also forgot to mention I'm using sdk v2.00.00.04

  • Hello Carlos,
    Have you tried running SPI driver test application (SPI-slave) where it has PC based SPI-master application to read data from AWR1642 (SPI-slave)
    C:\ti\mmwave_sdk_02_00_00_04\packages\ti\drivers\spi\test\xwr16xx
    Try to run this application first to verify SPI-slave on the device is working fine.

    The ASSERT what you have mentioned on top is occurring at the mmWave library while writing data over mailbox to DSS/MSS core, you need to check that point.


    Regards,
    Jitendra
  • I haven't. Right now I can't test it but as soon as I go back from holiday I will do it.

    How do you suggest running the test code? should I copy the Test_spiSlaveWithPC to my code and see what happens? Or do I need to compile the test code into the device?

  • Try to run individual SPI test appliaction where it provides PC based application to complete master-slave communication. This is to get the understanding of code flow and then try to move specific/required code from there to your application.

    Regards,
    Jitendra
  • I'll try as soon as possible and I'll come back here to post the results. thanks

  • hi, I ran the test application and I'm getting the following console feed:

    [Cortex_R4_0] ******************************************
    Debug: MibSPI Driver Test Application Start
    ******************************************
    Feature: SPI_open API test (instance=0): Passed
    Debug: SPI Instance @0800fe50 has been opened successfully
    Debug: SPI Instance @0800fe50 has been closed successfully
    Debug: Passed DMA channel number check
    Feature: SPI_open API test - DMA channel validation (instance=0): Passed
    Feature: SPI_open API test - chip select validation (instance=0): Passed
    Feature: SPI_open API test - data size validation (instance=0): Passed
    Feature: SPI_open API test - bit rate validation (instance=0): Passed
    Debug: Open the SPI Instance for SPI transfer parameter check test
    ti.sysbios.family.arm.v7r.vim.Hwi: line 271: E_undefined: Hwi undefined, intnum: -1
    xdc.runtime.Error.raise: terminating execution

    any ideas?
  • I'm guessing that it is aborting when the SPI_transfer function gets called, as it did in my code.
  • I'm sorry I pressed the "this resolved my issue" button, it didn't...
  • also, I tried to run the sdk v3.00.08 test with the same exact result, and I was able to run the uart driver test with no problems

    EDIT: I've been able to finally run the test code with no problems. I think the issue was not having the DSP core connected. I've copied the Test code into my code, and when I run it, I get the following console feed:

    [Cortex_R4_0] Debug: SPI Instance @0801c84c has been reopened in MASTER mode successfully
    [C674X_0] {module#8}: "../dss_main.c", line 212: error {id:0x10000, args:[0x814364, 0x814364]}
    [Cortex_R4_0] Start SPI Write test with MSP43x
    Master write Throughput = f Mbps
    xdc.runtime.Main: "platform/mmwave_xwr16xx.c", line 1342: assertion failure
    xdc.runtime.Error.raise: terminating execution
    

    And then it aborts again. I've noticed that the [C674X_0]... line and xdc.runtime.Main: ... are the same errors that I had before.

    EDIT2: until now i've been running the spi code from the mboxread task. I've tried to move the code to main but still it crashes

  • Hi Carlos,

    I apologize for the delayed response - we did not see the replies after the thread was marked resolved.

    Could you please let us know if this is still an issue for you?

    Best Regards,
    Anand