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.

AWR2944: AWR2944 MibSPI Driver Synchronous request issue

Part Number: AWR2944

I find that when I use MibSPI and send messages repeatedly, only the first message gets through. However, even though I can see the slave response in the SPIBUF register, I am unable to see the slave's response in the SPI Rx buffer.

Investigating further, I discovered that the driver is coping the data and preparing the next request in the TxRxIrq (SPI interrupt handler), which surprises me as I was expecting a synchronous request and I didn't configure SPI IRQ.

The SPI driver which I'm using is part of MCAL package "MCAL_REL_02.00.05.01_RC2"

Supported AUTOSAR Release : 4.3.1
Vendor ID : SPI_VENDOR_ID (44)
Module ID :SPI_MODULE_ID (83)
Supported Platform : AWR29xx

I can see that the Synchronous request is passing in the SPI_Detailed_Test_Report , So I'm not sure what I'm doing wrong. Can you help me with this problem?

  • Hi Mohamed, 

    Can you share the configuration that you are using for the MibSPI for your use case.

    Regards,

    Shruti Gupta 

  • I'm using 1 channel, 1 job and 1 seq.

    channel configuration:

    • channelId = 5U
    • channelBufType = SPI_EB
    • dataWidth = 32U
    • defaultTxData = 0U
    • maxBufLength = 1U
    • transferType = SPI_MSB
    • qspiChMode    = SPI_QSPI_SFI_CHMODE_CMD,
    • qspiXferCmd = SPI_QSPI_SFI_CH_XFER_CMD_4PIN_WR_SINGLE

    Job configuration:

    • jobId = 6,
    • jobPriority = SPI_JOB_PRIORITY_3
    • hwUnitId = SPI_UNIT_MIBSPI1
    • csPin = SPI_CS0
    • Spi_JobEndNotification = (Spi_JobEndNotifyType)NULL_PTR
    • channelPerJob = 1
    • channelList {5}
    • externalDeviceCfgId = 1
    • qspiEnableMemMapMode = FALSE

    Sequence Configuration:

    • seqId = 6,
    • seqInterruptible = TRUE
    • Spi_SequenceEndNotification = (Spi_SeqEndNotifyType)NULL_PTR
    • jobPerSeq = 1
    • jobList {6}
    ExtDev Configuration
    • Spi_DioPin = SPI_CS0
    • Spi_CsProperty   = SPI_LOW           
    • Spi_Baudrate = 0x4U
    • Spi_Mode = SPI_CLK_MODE_1
    • Spi_ClkDelays = {0xffffU0x0000U}
    • Spi_CsIdleTime = 0x00U                
    • Spi_CsMode = SPI_CONTINUOUS
    • Spi_HwInstance = 0U
    • txRxMode     = SPI_TX_RX_MODE_TX_ONLY
    Spi_RamUsed : FALSE
  • Hi Mohamed,

    Have you checked the example first which is given in the folder, are you observing the same behavior there also, also, do you have your own test application, or you are using any of the example given? it would be better if you can provide some information about your use case.

    Regards,

    Shruti 

  • Yes, I used the same example code provided in MibspiApp.c, and also the same behavior because I did not configure TxRxIrq in my side.

    let me explain the issues to you on the code level;

    First issue:
    I started by calling Spi_SyncTransmit(), then the code did some process preparation related to the job's state, and sequance statues until it went to The "Spi_DlcConsumeEvent" function which is responsible for filling the data into the SPI TxBuffer and then triggers the transmission,

    the problem as you can see in the image below is that this function triggers only the first spi word (16 bits) and doesn't wait until the transmission is done (this what I'm expecting from synchronous function).



    So in my case the channel size consists of multiple spi words (32 bit), only the first 16 bits will be sent because the code is waiting IRQ to trigger the next spi word.


    "Spi_IrqTxRx" Function


    the second issue:
    The coping of SPIBUF register to application RX buffer is done only in TxRxIrq , So it will only work if we are using Asynchronous SPI request.


    Please if you are still having trouble understanding the issue, feel free to set up a meeting to explain the issue to you in more detail





  • Hi Mohamed,

    I need some time to recreate the issue at our end, will get back to you by early next week.

    Regards,

    Shruti

  • Hi Mohamed,

    is it possible for you to share your application code with us?

    Regards,

    Shruti

  • Currently, I'm using very simple code to test SPI

    uint32 srcDataBuf = 0;
    uint32 
    destDataBuf = 0;
    in Init function
    {

        Spi_Init(&SpiDriver);
        Spi_SetLoopbackMode(0,TRUE);
        
    Spi_SetupEB(5, (uint8 *) &srcDataBuf , (uint8 *) &destDataBuf , 1);

    }


    in periodic function every 100ms
    {

         srcDataBuf = 0x5A5A6B6B // test data changed by debugger

         Spi_SyncTransmit(6);

    }


    The observation , 

    1- destDataBuf is always zero
    2- RxData in SPIBUF is loaded by the first 16 bit of srcDataBuf 

  • Hi Mohamed, 

    Can you check the following things in the MibspiApp.h file 

    In the  SpiApp_TestParams gSpiAppTestPrms[] struct , what value you are using for .isAsynchMode did you change the default ASYNC/SYNC transmit flag for synchronous mode? 

    if not done yet, can you try changing it for synchronous mode and test your code.

    Regards,

    Shruti

  • The variable you mentioned "isAsynchMode" is used to choose the Asynch mechanism whatever it is pooling or interrupt
    In my case, I don't use the Asynch function in the first place, so this won't affect me at all.


     
    Could you try the Synchronous function in your side , and if possible add me to the debugging session please to speed up the process?

  • Hi Mohamed , 

    So there are 2 different things in the test params struct  -

    1. isAsyncMode - which defines whether to use async transmit or sync transmit.

    2. asyncMode - Whether to use polled or interrupt mode in async transmit.

    what you have mentioned above is asyncmode  , not isAsyncMode  , the possible values of isAsyncMode is either 0 or 1 , 0 stands for sync transmit mode , as of now in the MibspiApp.h file it's value has been set as 1 , can you verify if you have changed it to zero?

    Regards,

    Shruti

  • Hi shruti,

    Sorry for the typo, I meant "asyncMode" but I'm using the Spi_SyncTransmit function directly, as I mentioned to you a day ago.