Use DMA to get data and Send through BLE QN9080DK

cancel
Showing results for 
Search instead for 
Did you mean: 

Use DMA to get data and Send through BLE QN9080DK

303 Views
anniehung05911
Contributor II

Hi,

I want to use dma controller to get adc data and send through BLE on qn9080-dk.

I tried to use sample code bluetooth-private_profile_server and add dma controller (like adc-dma project) in the fsl_os_abstraction_free_rtos.c main function or in the private_profile_server.c.

But it didn’t work.

Is there anyone to help me? How should I add the dma controller to the BLE project.

Thanks

Labels (3)
0 Kudos
3 Replies

136 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Sorry but I'm not sure I fully understood your problem, did you add to the private profile example the DMA? Which API's are you using? Also, how are you adding the tasks and events? 

Regards, 
Estephania 

0 Kudos

136 Views
anniehung05911
Contributor II

Hi,

I want to get the continuous adc data, and send through BLE every second.

So I try to use dma controller to move adc data from peripheral to memory. (reference the adc-dma sample code)

I haven't create task or event.

About the DMA api I use,

DMA_Init(DMA0); DMA_EnableChannel(DMA0, DEMO_ADC_DMA_CHANNEL); DMA_CreateHandle(&g_adcDmaHandle, DMA0, DEMO_ADC_DMA_CHANNEL); DMA_SetCallback(&g_adcDmaHandle, ADC_ConvertDMACallback, &transferDone); DMA_PrepareTransfer(&transferConfig, (void *)&DEMO_ADC_BASE->DATA, g_AdcConvResult, sizeof(uint32_t), sizeof(uint32_t)*250, kDMA_PeripheralToMemory, &Init_dma_Desc);  DMA_SubmitTransfer(&g_adcDmaHandle, &transferConfig);  transferConfig.xfercfg.intA = true; transferConfig.xfercfg.intB = true;  DMA_CreateDescriptor(&g_pingpong_desc[1], &transferConfig.xfercfg, (void *)&DEMO_ADC_BASE->DATA, &g_AdcConvResult[250], &g_pingpong_desc[0]);  DMA_CreateDescriptor(&g_pingpong_desc[0], &transferConfig.xfercfg, (void *)&DEMO_ADC_BASE->DATA, &g_AdcConvResult[0], &g_pingpong_desc[1]); DMA_CreateDescriptor(&Init_dma_Desc, &transferConfig.xfercfg, (void *)&DEMO_ADC_BASE->DATA, &g_AdcConvResult[0], &g_pingpong_desc[1]);  DMA_StartTransfer(&g_adcDmaHandle);
‍‍‍

I first tried to put them in private_profile_server.c as a function.

And it didn't work.

Is it OK to create a task for DMA, like

OSA_TASK_DEFINE(startup_task, gMainThreadPriority_c, 1, gMainThreadStackSize_c, 0);

and use OSA_Mutex to control these two tasks?

0 Kudos

136 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Sorry, I assumed you were using the tasks, it is correct in either way nonetheless, will have to take care of not implementing any blocking routines that might make the Bluetooth LE functionality crash. 

Regards, 

Estephania 

0 Kudos