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.

SPI using DMA not able to make it up

Other Parts Discussed in Thread: MSP430F5659, DAC8750, ADS1292

Hi

I am working on ADS1292 and DAC8750 using SPI communication with MSP430F5659 controller.

Its working with normal write/read SPI routine. Since i am using TI RTOS i tried to use the TI RTOS API for the same.

Here i have a question how to set the DMA interrupt for both SPI, since ADS1292 i am using USCI B0 and for DAC8750 i am using USCI A1?

Or is it possible to use SPI without DMA for TI RTOS based application?

Can i get any reference code with or without DMA for TI RTOS?

i did the SPI attribute and H/w attribute as shown below is it correct?

/* Place into subsections to allow the TI linker to remove items properly */

#if defined(__TI_COMPILER_VERSION__)

#pragma DATA_SECTION(SPI_config, ".const:SPI_config")

#pragma DATA_SECTION(spiUSCIBDMAHWAttrs, ".const:spiUSCIBDMAHWAttrs")

#pragma DATA_SECTION(spiUSCIADMAHWAttrs, ".const:spiUSCIADMAHWAttrs")

#endif

#include <ti/drivers/SPI.h>

#include <ti/drivers/spi/SPIUSCIBDMA.h>

#include <ti/drivers/spi/SPIUSCIADMA.h>

SPIUSCIBDMA_Object spiUSCIBDMAObjects[MSP_EXP430F5529LP_SPICOUNT];

uint8_t spiUSCIBDMAscratchBuf[MSP_EXP430F5529LP_SPICOUNT];

SPIUSCIBDMA_Object spiUSCIADMAObjects[MSP_EXP430F5529LP_SPICOUNT];

uint8_t spiUSCIADMAscratchBuf[MSP_EXP430F5529LP_SPICOUNT];

const SPIUSCIBDMA_HWAttrs spiUSCIBDMAHWAttrs[0] = {

{

.baseAddr = USCI_B0_BASE,

.clockSource = USCI_B_SPI_CLOCKSOURCE_SMCLK,

.bitOrder = USCI_B_SPI_MSB_FIRST,

.scratchBufPtr = &spiUSCIBDMAscratchBuf[0],

.defaultTxBufValue = 0,

/* DMA */

.dmaBaseAddr = DMA_BASE,

/* Rx Channel */

.rxDMAChannelIndex = DMA_CHANNEL_1,

.rxDMASourceTrigger = DMA_TRIGGERSOURCE_18,

/* Tx Channel */

.txDMAChannelIndex = DMA_CHANNEL_0,

.txDMASourceTrigger = DMA_TRIGGERSOURCE_19

}

};

const SPIUSCIADMA_HWAttrs spiUSCIADMAHWAttrs[1] = {

{

.baseAddr = USCI_A1_BASE,

.clockSource = USCI_A_SPI_CLOCKSOURCE_SMCLK,

.bitOrder = USCI_A_SPI_MSB_FIRST,

.scratchBufPtr = &spiUSCIADMAscratchBuf[0],

.defaultTxBufValue = 0,

/* DMA */

.dmaBaseAddr = DMA_BASE,

/* Rx Channel */

.rxDMAChannelIndex = DMA_CHANNEL_1,

.rxDMASourceTrigger = DMA_TRIGGERSOURCE_20,

/* Tx Channel */

.txDMAChannelIndex = DMA_CHANNEL_0,

.txDMASourceTrigger = DMA_TRIGGERSOURCE_21

}

};

const SPI_Config SPI_config[] = {

{

.fxnTablePtr = &SPIUSCIBDMA_fxnTable,

.object = &spiUSCIBDMAObjects[0],

.hwAttrs = &spiUSCIBDMAHWAttrs[0]

},

{

.fxnTablePtr = &SPIUSCIADMA_fxnTable,

.object = &spiUSCIADMAObjects[1],

.hwAttrs = &spiUSCIADMAHWAttrs[1]

},

{NULL,NULL,NULL},

};

I don't know how to set the DMA channel for for SPI B0 and SPI A1,

Please can any one help me to resolve this issue.

Nitesh

  

  • Hi Nitesh,

    I think the best option for you would be to rebuild TI-RTOS for MSP430F5659 (TI-RTOS doesn't ship with pre-built libraries for MSP430F5659).

    To rebuild TI-RTOS for that platform, you need to add it to the variable "MSP430DEVLIST" in tirtos.mak and then rebuild TI-RTOS. (For details on how to rebuild TI-RTOS, please refer to the TI-RTOS User Guide [in the docs/ folder of your installation]).

    The next issue you will have is that there is no SPI example for the MSP430F5659.  So, I recommend creating a new TI-RTOS project for MSP430F5659, and then transferring over the code of the SPI loopback example for the MSP-EXP432P401R launchpad, in particular the code from the example file spiloopback.c.

    Please also refer to the following thread, which has several useful links that will help you with this.

    e2e.ti.com/.../1670232

    Steve

  • Hi Steve,

    I have the build the TI RTOS library for MSP430F5659 controller. But i could not find any example on SPI using DMA. More over which channel to select for USCI B0 and USCI A1? Its not given anywhere. Since i have two SPI devices using two separate module A and B.

    I will check the MSP-EX432P401R and get back to you.

    Thanks

    Nitesh 

  • Nitesh,

    Did you have any update on this issue?

    Steve
  • Hi Steve,

    Yes i have some updates, Its worked fine but still accuracy was not met properly.

    We saw while initialization after reset command/ reset pin low to high, if we give delay accuracy is going to and forth inversely. i.e. more delay around 10-50ms its accurate for the lower value(4mA ~ 0.4v) measurement but for the higher value(20mA ~ 2.0v) measurement its not correct, same vice versa with less delay 1ms.

    For More delay 0.4v measuring 0.3987v , 2.0v measuring 2.132v

    less delay 0.4v - measuring 0.3943v, 2.0v measuring  2.001v

    Ex- We have given input 8mA current input ADC 2nd channel, the differential voltage is 0.8V.

    Voltage levels at the inputs with respect to AGND- 0.8V at IN2P and 0V at IN2N

    And with input shorted setting we found 0.0005v offset.

    What could be the issue its not linear any idea how to make it linear w.r.t voltage ?

    Your help will be appreciated thanks in advance.

    Nitesh