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.

LAUNCHXL-CC26X2R1: HWI exception in SPI callback operation

Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: SYSCONFIG, SIMPLELINK-CC13XX-CC26XX-SDK

Greeting. Thanks ahead for helping out.

Background

I tried to confifure the SPI module on the CC2652 LAUNCHXL board. With setting specified below:

Parameters

SPI_Params signalAcquisitionTask_spi_params;
SPI_Params_init(&signalAcquisitionTask_spi_params);
signalAcquisitionTask_spi_params.mode = SPI_MASTER;
signalAcquisitionTask_spi_params.bitRate = 4000000;
signalAcquisitionTask_spi_params.dataSize = 16;
signalAcquisitionTask_spi_params.frameFormat = SPI_POL0_PHA1;
signalAcquisitionTask_spi_params.transferMode = SPI_MODE_CALLBACK;
signalAcquisitionTask_spi_params.transferCallbackFxn = signalAcquisitionTask_spiTransmissionCb;


Transaction

SPI_Transaction  signalAcquisitionTask_spi_transaction;
uint16           signalAcquisitionTask_spi_txBuffer[16];
uint16           signalAcquisitionTask_spi_rxBuffer[16];

signalAcquisitionTask_spi_transaction.arg = NULL;
signalAcquisitionTask_spi_transaction.txBuf = signalAcquisitionTask_spi_txBuffer;
signalAcquisitionTask_spi_transaction.rxBuf = signalAcquisitionTask_spi_rxBuffer;
signalAcquisitionTask_spi_transaction.count = frameSize;

Issue

When SPI_transfer is called, an HWI exception is raised. Somehow the code hit the Hwi_excHandlerAsm. There is not much information i can gather from the ROV.

Investigation

I suspect that there might be incorrect setup on the SPICC26X2DMA_Object and SPICC26X2DMA_HWAttrs. Hence the values before the execution of SPI_transfer is captured.

SPICC26X2DMA_Object 

SPICC26X2DMA_HWAttrs

I wonder would it be the issue in the null head and tail Ptr which include the Hwi_excHandlerAsm pointer. Just a wild thought.

Question

1. Any idea about the issue?

2. Is there any way I can put a breakpoint in the SPICC26X2DMA.c for debugging?

3. I recall a post about heap issue mentioned. I did check the heap but i didnt find anything useful. Is Heap management a concern in the application design.

Please tell me if i can provide more detail. Thanks in advance. 

  • Hi Tony,

    I am assuming that you used the spimaster example as a basis for your demo code?  I agree that there must be an issue with initialization which causes a HWI.  Here is documentation concerning the SPI TI Driver for more information.  Which version of the SIMPLELINK-CC13XX-CC26XX-SDK, RTOS, and Compiler are you referencing?  Have you initialized a SPI module in SysConfig and does SPI_open successfully return a handle instead of NULL?  You can also review the Debugging Guide and furthermore copy the SPICC26X2DMA.c file directly into your project directory to further debug the functions included within.

    Regards,
    Ryan

  • Thanks for the reply.

    1. Version of the build

    SDK - SimpleLink CC13xx CC26xx SDK - 6.20.00.29

    RTOS - TI-RTOS7

    Complier - TI Clang v1.3.0.LTS

    2. Initialisation

    SysConfig seems does not provide SPI_init(). But I did call it before the initialisation of the spi_params. So in the code it looks like this.

    // --> Setup for SPI module
        // Initial value for SPI handle object and fxnTable
        SPI_init();
        // Initial value for SPI parameter
        SPI_Params_init(&signalAcquisitionTask_spi_params);
        signalAcquisitionTask_spi_params.mode = SPI_MASTER;
        // Bit rate can be u to 12MHz for master operation, specified in UDMACC26XX.h
        signalAcquisitionTask_spi_params.bitRate = 4000000;
        // 4 to 16 bit - Set into 16 bit for better handling
        signalAcquisitionTask_spi_params.dataSize = 16;
        signalAcquisitionTask_spi_params.frameFormat = SPI_POL0_PHA1;
        signalAcquisitionTask_spi_params.transferMode = SPI_MODE_CALLBACK;
        signalAcquisitionTask_spi_params.transferCallbackFxn = (SPI_CallbackFxn) signalAcquisitionTask_spiTransmissionCb;

    I think SPI_open() was implemented successfully. The object and hwAttrs shown above was provided by handle. In addition the fxnTable are pointing to the SPICC26X2DMA.c function. So i assume that the SPI_open method is kinda ok.

    Thanks for the attention. Meanwhile i will try to debug it as instructed.

  • ou can also review the Debugging Guide and furthermore copy the SPICC26X2DMA.c file directly into your project directory to further debug the functions included within.

    Welp. It is quite embarassing that i did find out where the problem is and it is quite stupid. Turn out it is indeed the handle issue. But anyway in direct inlucsion of SPICC26X2DMA.c file did help the debugging process.

    Thank you Ryan and I apologise for wasting your attention on this simple issue. Good day.