STM32F303 SPI3 DMA2 negeneruje TC flag
Stano
stano.hw na gmail.com
Středa Srpen 14 00:53:31 CEST 2013
Zdravim konferenci
Uz sa peknych par hodin trapim z nasledovnym problemom.
Potrebujem po odvysielani (a prijati) dat cez SPI nahodit CS. Chcel som
pouzit TC flag DMA na RX SPI.
Ak mam zapnute inkrementovanie pamate vsetko funguje dobre. Ak vsak
chcem vysielat a na prijimanych datach nezalezi je inkrementovanie RAM
vypnute. A v tomto pripade STM negeneruje TC flag. Pokusal som sa o
workarround s tym ze pockam na TC flag od zapisu do SPI a potom na RNXE
od SPI periferie, zial bez uspechu.
Na STM32F103 som na tento problem nenarazil aj ked DMA periferia je
velmi podobna tej z F303.
Stretol sa s tym niekto?
Nastavenie DMA:
DMA_InitStructure.DMA_PeripheralBaseAddr =
(uint32_t)(&(SPIMMC->DR));
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_PeripheralDataSize =
DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
/* DMA_SPI_RX */
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)(&rw_dummybyte);
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;
DMA_Init(SPIMMC_DMA_CHANNEL_RX, &DMA_InitStructure);
/* SPI_DMA_TX */
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)buff;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_Init(SPIMMC_DMA_CHANNEL_TX, &DMA_InitStructure);
DMA_Cmd(SPIMMC_DMA_CHANNEL_RX, ENABLE);
DMA_Cmd(SPIMMC_DMA_CHANNEL_TX, ENABLE);
/*--------------------------------------------------------------------*/
/* DMA TC flag nenastavi a program zamrzne v nasledovnom riadku */
while (DMA_GetFlagStatus(SPIMMC_DMA_FLAG_RX_TC) == RESET) { ; }
S pozdravom
Stano
Další informace o konferenci Hw-list