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.

IWR6843: SPI transaction write when sending the radar data output

Part Number: IWR6843


Hi TI,

Problem: I was trying to send enable the SPI communication to send messages from the IWR6843 SPI Slave (within MMwaveICBoost board) to an external microcontroller that will serve as SPI Master. Here is a snippet of my code, and the stack dump of the error that happen when I call SPI_transfer( )..

SPI Initial Test (without radar): I had enabled the #define SPI_MULT_ICOUNT_SUPPORT in the mibspi_dma.c and recompile the mmwave SPI Driver as I am planning to send more data thru SPI lines. I had tried sending dummy msg like 0,1,2,3... and it is working well across 256 uint16_t words send in 2 SPI transactions.

SPI Actual Test (with radar): Then, I start running the IWR6843 DSS to get the chirp data output from the regular demo, and then on the way back thru the MmwDemo_mboxReadTask( ), it send the data thru UART as usual first and then I send it thru my SPI channel next. This is the part I am getting the issue at.

Code
void SPI_Init_Fcn() { SPI_Params params; DMA_Params dmaParams; /* Init SYSDMA params */ DMA_Params_init(&dmaParams); /* Open DMA driver instance 0 for SPI */ dmaHandle = DMA_open(0, &dmaParams, &errCode); if (dmaHandle == NULL) { System_printf("Open DMA driver failed with error=%d\n", errCode); return; //jgi } SPI_init(); /* Setup SPI Parameters */ SPI_Params_init(&params); params.frameFormat = SPI_POL0_PHA1; //jgi, why did you change the phase? //was SPI_POL0_PHA1 params.pinMode = SPI_PINMODE_4PIN_CS; params.shiftFormat = SPI_MSB_FIRST; params.dataSize = 16; params.transferMode = SPI_MODE_BLOCKING; //jgi, added /* Enable DMA and set DMA channels to be used */ params.dmaEnable = 1; params.dmaHandle = dmaHandle; params.eccEnable = 1; params.mode = SPI_SLAVE; params.u.slaveParams.chipSelect = 0; params.u.slaveParams.dmaCfg.txDmaChanNum = 1U; params.u.slaveParams.dmaCfg.rxDmaChanNum = 0U; //params.transferTimeout=TIMEOUT_MS; //SemaphoreP_pend description says to set timeout in ms, not system ticks as TI docs say //jgi: was enabled spiHandle = SPI_open(0, &params); } void SPI_Send_Transaction() { SPI_Transaction transaction; // send a large transaction tx_ready = LARGE_MSG; transaction.count=sizeof(tx_ready); transaction.txBuf=&tx_ready; transaction.rxBuf=&rx_ready; SPI_transfer(spiHandle, &transaction); //this is where the issue is! }

Let me know some insights or things I could try to make it proceed properly. Thanks so much .

  • Hi TI,

    Problem: I was trying to send enable the SPI communication to send messages from the IWR6843 SPI Slave (within MMwaveICBoost board) to an external microcontroller that will serve as SPI Master. Here is a snippet of my code, and the stack dump of the error that happen when I call  SPI_transfer( )

    SPI Initial Test (without radar): I had enabled the #define SPI_MULT_ICOUNT_SUPPORT in the mibspi_dma.c and recompile the mmwave SPI Driver as I am planning to send more data thru SPI lines. I had tried sending dummy msg like 0,1,2,3... and it is working well across 256 uint16_t words send in 2 SPI transactions.

    SPI Actual Test (with radar): Then, I start running the IWR6843 DSS to get the chirp data output from the regular demo, and then on the way back thru the MmwDemo_mboxReadTask( ), it send the data thru UART as usual first and then I send it thru my SPI channel next. This is the part I am getting the issue at.

    I think the formatting of my message above got messed up. Read this one first, and then go the Code and Stack dump above. Sorry for inconvenience.

  • Hi Jonathan,

    I've asked an expert to look into this and we should have an answer for you in the next few days.

     

    Cheers,

    Akash

  • Hi Jonathan,

    Please refer to Note 2 in SPI driver documentation @C:\ti\mmwave_sdk_03_03_00_03\packages\ti\drivers\spi\docs\doxygen\html\index.html.

    Please make sure the requirements are met in order to make it work in Slave 4 pin mode.

    SPI transfer with multiple RAM buffer (icount)

    SPI hardware has an internal RAM buffer that stores transmit/receive data element in 8bits or 16bits. The SPI driver has a compile time option to transfer data bigger than RAM buffer size. This is intended for high throughput transfers. But it has some limitations and not supported in all SPI modes.

    SPI modePin ModeSupported?Limitations
    Master 4-pin Yes Note1
    Master 3-pin Yes Note1
    Slave 4-pin Yes Note2
    Slave 3-pin No None

    Note1: There will be gaps between every transfer of the RAM buffer size for internal DMA copy of the data. During this time, Clock and CS will be inactive.

    Note2: Slave needs time to do DMA copy of received data for every RAM buffer. Hence require the SPI master to deactivate CS/ClK signal during this time. When using another XWR1xxx device as master, it can be achieved by setting C2Tdelay/T2Cdelay/wdelay.

    The maximum elements is defined as MIBSPI_RAM_MAX_ELEM. For multiple slaves scenarios, this number is divided among all slaves. This information is provided from application in SPI_MasterModeParams. The maximum icount value is 32. Please make sure the transfer length is not exceed 32 * ramLen. For High clock rate, it is recommended to use small icount values.

    Thanks

    Yogesh

  • Yogesh,

    Thanks for answer. To make it possible to enable 4-pin SPI (MISO, MOSI, CLK, CS), is it 

    a) In mibspi_dma.c,  enable the #define SPI_MULT_ICOUNT_SUPPORT

    b) In SPI.h, change it to #define MIBSPI_RAM_MAX_ELEM          128U    (was 64U)

    I am receiving errors such as DSS Frame Processing Deadline Miss Exception. But I notice it is working if I put a breakpoint on the SPI Write in my mss_main.c and I hit F8 to send all 2x 128 uint16 at a time. But when I remove the breakpoint and let it run continously, it hit the error on previous post. 

    For DSS Frame exception, I had tried changing the frame periodicity in profile, ie. frameCfg 0 0 2 0 50 1 0, I tried 50 up to 100, and still it is failing. 

    Some question

    1. Where do I change the maximum icount value of 32? 

    2. What is the ramLen mentioned here?  My clock is run at around 7MHz SPI clk. 

    Let me know what you think and thank you so much. 

    Jonathan

  • Hi Jonathan,

    Changes seems fine. 

    1. Where do I change the maximum icount value of 32? 

    icount value should not exceed 32.  Is the icount value exceeding 32 in your application?

    2. What is the ramLen mentioned here? 

    MIBSPI_RAM_MAX_ELEM

    May I ask, which device are you testing the SPI against.

    Thanks

    Yogesh

  • Yogesh,

    1. The only change I did in SPI driver is mibspi_dma.c on these lines, 

    /* Flag to enalbe Params check */
    //#define SPI_PARAMS_CHECK //jgi: was enabled

    /* Support for multi icount in one transfer to achieve high throughput , this is only supported in blocking mode */
    #define SPI_MULT_ICOUNT_SUPPORT //added jgi here on 11/2019

    What do you think is the icount number here? I am not sure.

    2. OK. Let me test it some more.  Thanks so much. 

    Question:  In compiling this mmwave SPI drivers, I believe I should use "gmake all" rather than "make all"? I am on a Win10 PC.  Thanks.

  • Hi Jonathan,

    If you are not modifying the max icount directly, you should be fine.

    As is said before  the multi buffer is not supported in all mode. What's the device you are using it to test with.

    Thanks

    Yogesh

  • Hi Jonathan,

    Since I didn't hear from you, I am closing this thread. Please open a new thread if you are still having issue.

    Thanks

    Yogesh