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.
Tool/software: TI-RTOS
We are using MSP430F6779 with TI-RTOS . Currently we are unable to write/read the external flash via SPI since it gets stucked in the following line
Status=SPI_transfer( spiHandle, &spiTransaction);
When we did the debugging, we found out that upon entering DMA interrupt it is not returning from the ISR.
Attaching the debug window screenshot
SPI function
/* SPI TEST STARTS*/
SPI_Transaction spiTransaction;
SPI_Handle spiHandle;
SPI_Params spi_params;
SPI_Params_init(&spi_params);
spi_params.transferTimeout = 10;
spiTransaction.count=1;
// spiTransaction.rxBuf = NULL;
spiTransaction.rxBuf = &spi_rxbuf[0];
spiTransaction.txBuf = &spi_txbuf[0];
spiHandle = SPI_open(0,&spi_params);
spi_txbuf[0]=0x06; // wren : write enable
while(1){
GPIO_setOutputLowOnPin(GPIO_PORT_P4, GPIO_PIN7);
GPIO_setOutputHighOnPin(GPIO_PORT_P4, GPIO_PIN7);
GPIO_setOutputLowOnPin(GPIO_PORT_P4, GPIO_PIN7); //CE
Status=SPI_transfer( spiHandle, &spiTransaction);
GPIO_setOutputHighOnPin(GPIO_PORT_P4, GPIO_PIN7); //CE
spiTransaction.count=5;
spi_txbuf[0]=0x02; // write instruction
spi_txbuf[1]=0x07; // address
spi_txbuf[2]=0x00; // address
spi_txbuf[3]=0x00; // address
spi_txbuf[4]=0xA9; // Data
GPIO_setOutputLowOnPin(GPIO_PORT_P4, GPIO_PIN7); //CE
// spiTransaction.txBuf =spi_txbuf;
SPI_transfer( spiHandle, &spiTransaction);
GPIO_setOutputHighOnPin(GPIO_PORT_P4, GPIO_PIN7); //CE
/*
spiTransaction.count=4;
spi_txbuf[0]=0x03; // read
spi_txbuf[1]=0x07;
spi_txbuf[2]=0x00;
spi_txbuf[3]=0x00;
GPIO_setOutputLowOnPin(GPIO_PORT_P4, GPIO_PIN7); //CE
// spiTransaction.txBuf =spi_txbuf;
SPI_transfer( spiHandle, &spiTransaction);
GPIO_setOutputHighOnPin(GPIO_PORT_P4, GPIO_PIN7); //CE
for(i=0;i<10;i++)
{
data[i]=spi_rxbuf[i];
}
*/
/* SPI TEST ENDS */
Configuration file
var hwi3Params = new halHwi.Params();
hwi3Params.arg = 0;
halHwi.create(46, "&SPIEUSCIBDMA_fxnTable", hwi3Params);
SPI INITIALIZATION (This initialization is done in the main before calling BIOS start)
#include <ti/drivers/SPI.h>
#include <ti/drivers/spi/SPIEUSCIBDMA.h>
SPIEUSCIBDMA_Object spiUSCIBDMAObjects[MSP_EM430F67791_SPICOUNT];
uint8_t spiUSCIBDMAscratchBuf[MSP_EM430F67791_SPICOUNT];
const SPIEUSCIBDMA_HWAttrs spiUSCIBDMAHWAttrs[MSP_EM430F67791_SPICOUNT] = {
{
.baseAddr = EUSCI_B1_BASE,
.clockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
.bitOrder = EUSCI_B_SPI_MSB_FIRST,
.scratchBufPtr = &spiUSCIBDMAscratchBuf[0],
.defaultTxBufValue = 0,
/* DMA */
.dmaBaseAddr = DMA_BASE,
/* Rx Channel */
.rxDMAChannelIndex = DMA_CHANNEL_2,
.rxDMASourceTrigger = DMA_TRIGGERSOURCE_27,
/* Tx Channel */
.txDMAChannelIndex = DMA_CHANNEL_1,
.txDMASourceTrigger = DMA_TRIGGERSOURCE_28
}
};
const SPI_Config SPI_config[] = {
{
.fxnTablePtr = &SPIEUSCIBDMA_fxnTable,
.object = &spiUSCIBDMAObjects[0],
.hwAttrs = &spiUSCIBDMAHWAttrs[0]
},
{NULL, NULL, NULL},
};
/*
* ======== MSP_EM430F67791_initSPI ========
*/
void MSP_EM430F67791_initSPI(void)
{
/*
* NOTE: TI-RTOS examples configure USCIB0 as either SPI or I2C. Thus,
* a conflict occurs when the I2C & SPI drivers are used simultaneously in
* an application. Modify the pin mux settings in this file and resolve the
* conflict before running your the application.
*/
/* SPI CLK */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P4, GPIO_PIN6); // P4.6
/* MOSI/SIMO */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P4, GPIO_PIN5); // P4.5
/* MISO/SOMI */
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, GPIO_PIN4); // P4.4
SPI_init();
}
Are you adding an ISR for the DMA? Something like:
Void DMA_ISR(UArg arg) { /* Call the SPI DMA function, passing the SPI handle obtained from SPI_open */ SPI_serviceISR(spi_handle); }
With a code in the .cfg like:
var hwiParams = new halHwi.Params(); hwiParams.arg = 0; halHwi.create(50, "&DMA_ISR", hwiParams);
Just insure the proper DMA interrupt is placed instead of the "50" above.
**Attention** This is a public forum