TSI scan using DMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TSI scan using DMA

951 Views
amitmehta
Contributor III

i am developing application for scanning touch input and taking action based upon input but TSI scan is taking time as we need to scan channel one by one, so i want to move TSI scan from interrupt based to DMA based on KL16 so processing time can be saved and other tasks can be done during scan, but i am unable to configure DMA with TSI

6 Replies

587 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Sorry, I don't find a TSI combine with DMA example for your reference.

While, that application is quite similar with AN4590 application note, which using DAM to emulate ADC flexible scan mode. It also using DMA to get the ADC conversion result and software trigger the next channel.

Please refer here for the detailed info.

AN4590SW could be downloaded from here.

Wish it helps.

best regards,

Mike

587 Views
amitmehta
Contributor III

Hi,

thanks for reference code so i was also stuck for ADC DMA, so basically i try to port the code you shared for K24 using SDK 2.2 but i am unable to figure out in the code how ADC DMA is being triggered as in PDB i am unable to find any reference for ADC and further if you can help me getting this thing up and running with latest SDK available.

0 Kudos

587 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Amit,

I checked the KL16 chip, which doesn't include PDB module.

If you want to know how PDB hardware trigger ADC module, I would recommend you to download MCUXpresso SDK for FRDM-K64F. There provides the [ftm_pdb_adc16] demo located at below path:

..\SDK_2.3.0_FRDM-K64F\boards\frdmk64f\demo_apps\ftm_pdb_adc16

Wish it helps.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

587 Views
amitmehta
Contributor III

hi Hui_Ma

so took example from SDK and tried to configure to scan ADC using ADC major and minor loops. i took pdb adc and ADC_DMA example from SDK_2.3 for K64 controller available, so tried to modify pdb example to work in mode as described in AN4590SW example.

so initially i have configured ADC for channel and in DMA0 buffer i have given ADC channel 1 with two dma as per above example. but first to start DMA i have to trigger dma by adding below lines.

edma_config_t userConfig;

EDMA_GetDefaultConfig(&userConfig);
EDMA_Init(DEMO_DMA_BASEADDR, &userConfig);
EDMA_CreateHandle(&g_EDMA_Handle, DEMO_DMA_BASEADDR, DEMO_DMA_CHANNEL1);
EDMA_SetCallback(&g_EDMA_Handle, Edma_Callback, NULL);
EDMA_PrepareTransfer(&g_transferConfig, (void *)ADC16_RESULT_REG_ADDR, sizeof(uint32_t),
(void *)ui_adc_result, sizeof(uint32_t), sizeof(uint32_t),
sizeof(ui_adc_result), kEDMA_PeripheralToMemory);
EDMA_SubmitTransfer(&g_EDMA_Handle, &g_transferConfig);
/* Enable interrupt when transfer is done. */
EDMA_EnableChannelInterrupts(DEMO_DMA_BASEADDR, DEMO_DMA_CHANNEL1, kEDMA_MajorInterruptEnable);


/* Enable transfer. */
EDMA_StartTransfer(&g_EDMA_Handle);

when i put a break point in DMA call back i got some values and in ADC register ADC channel was set to 0 which was done during ADC initialization.

so my question was like to trigger second DMA which is responsible to change ADC channel do i need to do anything else apart from what is given in AN4590SW example.

0 Kudos

587 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

The DMA transfer logic is below:

pastedImage_1.png

So, the DMA channel 1 using to transfer ADC conversion result data, after than, the channel link will trigger start Channel 0 to software start next round ADC conversion.

Wish it helps.

best regards,

Mike

587 Views
amitmehta
Contributor III

Hi Mike,

thanks for you help found reference code in SDK_2.3 for k64 now i am able to configure ADC with 2 DMA, i still have to try same for TSI.

I have another doubt regarding TSI but i think i should create different discussion for that because that is regarding auto noise mode 

0 Kudos