2014-06-02 05:32 AM
Hi,
We are working on STM32F417.We are getting a ''problem'' (if it is a problem) with the SPI through DMA.The function which send data through SPI is selecting the device at the beggining and unselecting it after the transfer.With a normal SPI transmission we get the ''unselect device'' right after the transmission is completed, for any baud rate prescaler. (see printscreen with a baud rate prescaler of 8)2014-06-02 05:58 AM
> Do you have any idea where this can come from?
No, because we don't know how do you generate the chipselect signal. JW2014-06-02 06:09 AM
True, sorry about that.
We are working with FreeRTOS.We are taking a semaphore that the DMA Handler gives. {........
DMA_SetCurrDataCounter(DMA_TX, __u8_DataTotalLength);
DMA_Cmd(DMA_TX, ENABLE);
xSemaphoreTake(_x_SemaphoreSendingOK, portMAX_DELAY);
vHILWIZNET_UnselectDevice(); // Unselect device each time an operation is done
}The Unselect function just set a I/O.And this is the DMA handler:void DMA1_Stream5_IRQHandler(void)
{
signed portBASE_TYPE __x_HigherPriorityTaskWoken = pdFALSE;
if (DMA_GetITStatus(DMA_TX, DMA_IT_TCIF5))
{
/* Clear DMA Stream Transfer Complete interrupt pending bit */
DMA_ClearITPendingBit(DMA_TX, DMA_IT_TCIF5);
xSemaphoreGiveFromISR(_x_SemaphoreSendingOK,&__x_HigherPriorityTaskWoken);
portEND_SWITCHING_ISR(__x_HigherPriorityTaskWoken);
}
}Marc
2014-06-02 06:16 AM
It's then a task-switching problem in the OS, isn't it? Can't you toggle the chipselect pin directly in the DMA ISR? Sorry, I don't RTOS, so can't comment further.
JW