2020-12-17 06:01 AM
Hi to all,
I need to send on every TIM interrupt a packet stream to SPI1. I can't use the HAL_SPI_Transmit(...) because it is blocking....so I need to use the DMA but not in circular mode.
I can not use the synchronization of DMA with lptim using DMAMUX because I just use all lptim in othe functions. What I need is send on everery TIM isr a packet stream to SPI using DMA but is I use the isr code attached only the first byte get out.
void TIM2_IRQHandler(void)
{
U16 zDacValue;
static U8 yDacChannel = Dac2666_eChannel0;
/* Clear interrupt flazOutValuegs */
__HAL_LPTIM_CLEAR_FLAG(&gLptim3Handle, LPTIM_IT_ARRM);
yDacChannel++;
if( yDacChannel >= (sizeof(gDac2Config)/sizeof(Dac2666_tSeqConfig)))
{
yDacChannel = 0;
}
zDacValue = gDac2Config[yDacChannel].DataBuffer[0];
/* Prepare command for next channel */
gDac2TxBuffer[0] = gDac2Config[yDacChannel].AdcChannel + (DAC2666_WR_CODE_TO_CHANNEL << 4);
gDac2TxBuffer[1] = (U8)((zDacValue >> 8) & 0x00FF);
gDac2TxBuffer[2] = (U8)((zDacValue >> 0) & 0x00FF);
/* Init the SPI interface to ADC converter */
if( HAL_SPI_Transmit_DMA(GetSpiHandle(HalSpi_eCh1), (U8*)gDac2TxBuffer, DAC2666_SPI_BUFFSIZE) != HAL_OK )
{
yDacChannel = 0;
}
}