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.

Data missing from SSI via DMA.

Other Parts Discussed in Thread: TM4C129ENCPDT

Hi,

I have configured SSI to get data from DMA and I have attached the code for reference.  Sometimes I am observing that I am missing data in DMABuffer.  My data contains sequence number which can be validated but its missing in DMABuffer. 

I have conducted a test as below:

I had made sure that DMABuffer is not accessed and modified elsewhere I have commented other part of code and had it only in interrupt (SSI0_dma_int).  If I run the code for some time and watch this buffer in watch window I am seeing that some data missing.

DMABuffer buffer will be filled only by DMA and why it is not in proper order?

Regards

8357.spiDMA_pseudoCode.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
DMA is Inialized on power up.
*/
void initDMA (void)
{
Error_Block eb;
Hwi_Params hwiParams;
ULONG lnTemp;
if(!DMA_initialized){
Error_init(&eb);
Hwi_Params_init(&hwiParams);
Hwi_construct(&(hwiStruct), INT_UDMAERR, errorDMAHwi,
&hwiParams, &eb);
if (Error_check(&eb)) {
System_abort("Couldn't construct DMA error hwi");
}
SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
uDMAEnable();
uDMAControlBaseSet(DMAControlTable);
DMA_initialized = TRUE;
}
}
power_up_init()
{
/*
On power up, GPIOs are configured.
*/
// *** SSI Module(FLASH) ***
MAP_GPIOPinConfigure(GPIO_PA2_SSI0CLK);
MAP_GPIOPinConfigure(GPIO_PA3_SSI0FSS);
MAP_GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
MAP_GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);
// Configure the GPIO pins for the SSI module
MAP_GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5);
}
/*
This function is called after power up routines.
During power up, SPI0 is working fine, its reading data from flash.
We change SPI0 from master to slave and want to read data from SSI0 using DMA.
*/
void run_time()
{
/* On power on I am having same SPI configured as Master
hence, closing it and later configuring as slave..
On power on we are reading data from FLASH, it is working fine.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Srinivasa

  • This doesn't appear to really be a TI-RTOS related query.
    What device are you running on?
  • Is this using the TI-RTOS SPI driver or are you using driverlib directly? What device are you using? On Tiva devices, TI-RTOS has a spi loopback example that you can refer to. If you are using driverlib, TivaWare probably has some SPI examples.

  • My code uses uses driverlib directly.

    Part number used: TIVA TM4C129ENCPDT

    TI-RTOS Version: 1_21_00_09.

    SSI examples provided in driverlib does not use DMA.  I am having problem with SSI with DMA in PING-Pong mode. 

    Analysis methodology:

    After a short run in debug mode, we are stopping the debugger and monitoring the DMABuffer.  Comparing received data with the pattern of data that we are supposed to receive we are noticing some missing data in DMABuffer.  To ensure that no other task is modifying this buffer we have commented the other parts of code where this buffer is read but still the same behavior and below details are also good. 

    • Master clock is good and it is as expected at 6.25 MHz.
    • Data to Tiva processor is monitored and it is good.
    • Interrupt to Tiva processor is at expected rate of 1 milliseconds.

    Regards

    Srinivasa

  • Srinivasa,

    I went ahead and moved this thread over to the device forum in hopes that you will get a faster response there.
  • Hello Srinivasa,

    First of all the TI RTOS version being used is a very old version and may be so is the TivaWare in the same.

    Secondly, if you run the same in TivaWare w/o any RTOS does it still occur?

    Regards
    Amit
  • Hi Amit,

    TI-RTOS Version: 1_21_00_09.

    Tivaware: TivaWare_C_Series-2.0.1.11577a

    I haven't tried with TivaWare only without RTOS.

    Regards

    Srinivasa

  • Hello Srinivasa,

    Yes, it is old version. The current version of TivaWare is 2.1.1. Also there may be updates to the TI-RTOS drivers that i suspect would have a major impact.

    To simplify the issue, I would request you to create a small project with TivaWare only to reproduce the issue.

    Regards
    Amit
  • Hi Amit,

    It’s a good idea to create a project with TivaWare only but it may not be feasible in our case because I need to configure the peripheral (i.e DSP) but all the configuration parameters comes via Ethernet and without sending proper configuration, DSP will not send data on SPI.

    If I remove RTOS, I think I won’t be having NDK and hence the Ethernet. Is there any other way of isolating this issue?

    Regards
    Srinivasa
  • Hello Srinivasa

    You can run the SSI in internal loopback mode and send the data from the SSI TX to RX pin to trigger the DMA function.

    Regards
    Amit
  • Hello Amit,

    That's great. Will try that and update you on that.

    Regards
    Srinivasa