cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer usb cdc data using DMA?

ildong
Visitor

Hello everyone.
I am using st32f407 chip to drive ad7606c ADC chip, and I want to output real time graph from PC to matlab via usb.
ad7606c outputs busy signal at the end of conversion, and GPIO callback function is executed like below according to busy signal.

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if(GPIO_Pin == BUSY_Pin && dma_busy == 0) {
Start_ADC_DMA_Receive();
}
}

Then the ‘Start_ADC_DMA_Receive()’ function is executed, which is shown below.

// Start receiving DMA (call only once, repeat in subsequent callbacks)
void Start_ADC_DMA_Receive(void) {
dma_busy = 1;
//HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_3); // Toggle LEDs for status checking

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_RESET); // CS Low

However, if the DMA reception completion callback function is not executed afterward, the PA3(CS) pin output does not go high. The code is shown below.

// DMA Receive Complete Callback
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi) {
if (hspi->Instance == SPI1) {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_SET); // CS High


Why is the DMA callback function not executing?

I'll provide the full code as an attachment.

0 REPLIES 0