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.

RM48L930: MibSPI loopback not working

Part Number: RM48L930

Hello,

I am having trouble getting the mibspi loopback working.  I am using MibSPI1.  From my code I called mibspiInit() then mibspiEnableLoopback(mibspiREG1, 0 ).

In HALCoGen, my Data Format0 is set to 2.5Mbps, Charlen = 8 bits, WDelay = 0.  Using default MIBSPI delay settings.  Transfer Group 0:  selected Data Format 0, 5 words per transfer, oneshot mode, TRG_ALWAYS & TRG_DISABLED.  Chip Select Hold is also selected. 

When I run the code I see my data on the MIBSPI1SIMO pin, correct clock and data as expected.  Chip select goes active as expected.  But  mibspiGetData( mibspiREG1, 0, rxBuf )  returns all FFs instead of returning my expected data.  I also tried enabling Analog loopback but no difference in operation.

Can you suggest what I am missing to get MIBSPI1 loopback working?

thanks,

Keith

  • Hello Keith,

    Could you have a look at the example example_mibspiDma.c included with Halcogen? Although this example is using the DMA to load data to be transferred, it is still operating in loop back mode. You should be able to start with this code and work towards the specific configuration that you are trying to implement. Note that the source for this example is located at C:\ti\Hercules\HALCoGen\v04.06.01\examples\RM48x
  • Chuck,

    I looked at the example SPI DMA code.  To enable loopback it does not call the API in mibspi.c that uses the IOLPKTSTCR register.  Instead, it declares a local fcn named

    mibspiEnableInternalLoopback(mibspiREG1);  

    This function is a different method of loopback that does not test the spi SIMO/SOMI pins.  This function sets bit 16 of the mibspi1 GCR1 register:

    mibspi->GCR1 |= 1U << 16U;

    My observations: 

    1. calling this local function after mibspiInit() does not actually result in internal loopback working.  Why?  Because the ref manual states that SPIGCR1 register settings cannot be changed after SPIEN (bit 24) is set to 1, which is the final step in mibspiInit().  I tested this:  in mibspiInit(), if  I set bit 16 to a 1 in the same line of code where bit 24 is also set, then internal loopback works as expected.  Any comments?

    2. Coming back to the mibspi API function mibspiEnableLoopback(mibspiBASE_t *mibspi, loopBackType_t Loopbacktype),  my code calls this after mibspiInit(), per TI's mibSPI video tutorial.  But it doesn't result in loopback working.  I tried both Digital and Analog loopback modes.  But when I single step in the debugger just after this API call and before starting a mibspiTransfer, then manually (in the debugger) set the IOLPKTSTCR register to 0xA00 to enable loopback, then loopback works properly. 

    So my question on (2) is, why doesn't mibspiEnableLoopback() succeed in writing to register IOLPKTSTCR but manually punching in the setting via the debugger does?  Is there any errata concerning the mibspi or spi register accesses?

    thanks,

    Keith

  • Hi Keith

    I am auditing a few older forum posts that were potentially not resolved. Since it has been a while since this post was open and eventually locked, I wanted to check if you were able to resolve the issue or need further guidance?

    Regards
    Mukul
  • Yes, this has been resolved. I don;'t think the interface was enabled in Halcogen.

    Thanks, and regards,