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.

TMS320F28P650DK: SPI external loopback example only works during debugging.

Part Number: TMS320F28P650DK

Tool/software:

Hello everyone
I would like to set up an SPI communication and that is why I have first uploaded the spi_ex4_external_loopback_fifo_interrupt example. Unfortunately, it works differently depending on whether I have just set a breakpoint or not.

Without a breakpoint:
If I let it run normally, I can measure all signals on the oscilloscope except chip select. This stays low the whole time, even though it is also an active low signal, which is why I would actually expect at least a high level. Furthermore, it does not change. So it stays low the whole time.

With a breakpoint:
If I set a breakpoint, for example at SPI_writeDataNonBlocking(SPIB_BASE, sData[i]);, the level is always high as expected, unless it sends data, then it is briefly low.

Does anyone know what could be causing this? I would be very grateful for any help.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//#############################################################################
//
// FILE: spi_ex4_external_loopback_fifo_interrupt.c
//
// TITLE: SPI Digital Loopback with FIFO Interrupts
//
//! \addtogroup driver_example_list
//! <h1>SPI Digital External Loopback with FIFO Interrupts</h1>
//!
//! This program uses the external loopback between two SPI modules. Both
//! the SPI FIFOs and their interrupts are used. SPIA is configured as a peripheral
//! and receives data from SPI B which is configured as a controller.
//!
//! A stream of data is sent and then compared to the received stream.
//! The sent data looks like this: \n
//! 0000 0001 \n
//! 0001 0002 \n
//! 0002 0003 \n
//! .... \n
//! FFFE FFFF \n
//! FFFF 0000 \n
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello,

    The expert on this topic is currently out of office until Tuesday 9/3, so please expect a delayed response. I apologize for any inconvenience.

    Best Regards,
    Delaney

  • Perfect, thank you very much.


  • Hi,

    Do you observe the same behavior when using HW breakpoints as well? Example seems to be working as expected, but you are seeing different results depending on how BP is set which is also expected. Are you watching the variables in the expressions window as well? As specified in the datasheet, on the trailing end of the word, SPIPTE will go inactive except between back-to-back transmit words in both FIFO and non-FIFO modes. 

    Best Regards,

    Aishwarya

  • Thank you very much. I haven't tried it yet because I got it working two days ago by installing a small waiting loop.
    Of course, I don't know if this is the optimal solution and it would actually be nice to know what the problem is, but I can't invest that much time in it right now.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    __interrupt void spibTxFIFOISR(void)
    {
    uint16_t i;
    //
    // Send data
    //
    for(i = 0; i < 2; i++)
    {
    while(temp < 10000){
    temp++;
    }
    SPI_writeDataNonBlocking(SPIB_BASE, sData[i]);
    }
    //
    // Increment data for next cycle
    //
    for(i = 0; i < 2; i++)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


  • Hi,

    I don't think there is any problem here. There is a difference in output based on where you are setting the SWBP taking into account optimization of the project, function calls, etc.

    Adding that wait loop is definitely an acceptable method, and you could also use the device delay function as well to help ensure that the SWBP is occurring at the same desired location each time you hit the BP.

    Best Regards,

    Aishwarya

  • you could also use the device delay function as well

    Unfortunately I can't do that. I would actually like to use DELAY_US, but I get the following errors:



  • You can also try using this function found in sysctl.c as well: SysCtl_delay(t). 

    Best Regards,

    Aishwarya
  • Ahh perfect thanks :)

  • I will go ahead and close this thread if there are no more questions.

    Best Regards,

    Aishwarya