Data stall - SPI Master Transmiter - LPC55S04

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Data stall - SPI Master Transmiter - LPC55S04

ソリューションへジャンプ
1,523件の閲覧回数
mdoyon
Contributor I

I have been struggling the past couple of days to send multiple bytes using the SPI_MasterHalfDuplexTransferNonBlocking() function from the SD_2.x_LPC55S04 . I didn't find a way so far to toggle back SCLK between each frame (see picture attached). According to the user manual and the debugging tool, the transmitter is on stall mode. The only way I found so far was to use the EOT bit and send by packages with only 8 bits of data and #CS toggling each time. 

const spi_master_config_t FLEXCOMM3_config = {
.enableLoopback = false,
.enableMaster = true,
.polarity = kSPI_ClockPolarityActiveHigh,
.phase = kSPI_ClockPhaseFirstEdge,
.direction = kSPI_MsbFirst,
.baudRate_Bps = 4000000UL,
.dataWidth = kSPI_Data8Bits,
.sselNum = kSPI_Ssel0,
.sselPol = kSPI_SpolActiveAllLow,
.txWatermark = kSPI_TxFifo0,
.rxWatermark = kSPI_RxFifo1,
.delayConfig = {
.preDelay = 0U,
.postDelay = 0U,
.frameDelay = 0x1U,
.transferDelay = 0x1U
}
};

 

static void FLEXCOMM3_init(void) {
/* Initialization function */
SPI_MasterInit(FLEXCOMM3_PERIPHERAL, &FLEXCOMM3_config, FLEXCOMM3_CLOCK_SOURCE);
}

 

void taskSpi(void *pvParameters){

while(1)
{
SPI_MasterHalfDuplexTransferNonBlocking(SPI3, &spiHandle, &xfer);
while(!isFinished) {

}

isFinished = false;

// Send out.

vTaskDelay(2000/portTICK_PERIOD_MS);

}

 

// Prepare to send.
sendData[0] = WRITE_CONFIGURATION_3;
sendData[1] = KEEP_ALIVE_160_MICRO_SEC;

xfer.txData = sendData;
xfer.rxData = receiveBuff;

xfer.txDataSize = 2;
xfer.configFlags = kSPI_FrameAssert;
xfer.isTransmitFirst = true;


xfer.configFlags = kSPI_FrameDelay;xTaskCreate(taskSpi, "task2", 128, NULL, 2, NULL);
vTaskStartScheduler();

Any tips would be appreciated. 

0 件の賞賛
返信
1 解決策
1,512件の閲覧回数
mdoyon
Contributor I

Finally got it to work. The issue was in the clock settings. Main clock was too slow compared to FLEXCOMM3 which didn't give enough time to fill the FIFO.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,513件の閲覧回数
mdoyon
Contributor I

Finally got it to work. The issue was in the clock settings. Main clock was too slow compared to FLEXCOMM3 which didn't give enough time to fill the FIFO.

0 件の賞賛
返信