ADC sample time varies whle using USB HID rpotocol

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

ADC sample time varies whle using USB HID rpotocol

Jump to solution
753 Views
kamransial
Contributor I

I am using Kiel uvision for arm bare metal example project of  usb device with K20 72 Mhz.I have configured hid to 1 endpoint to send adc data to PC. hid binterval time is 1ms after every 1 ms the PC sends in token to kinetis controller and controller sends 64 bytes of adc data to pc. I have set adc on continuous conversion in interupt mode if i do not connect controller to pc the sample time of adc remains constant but when i connect controller to pc the samples time varies about 10 usec. i want a constant sample time of adc and usb communication in hid

mode together.

Labels (2)
0 Kudos
1 Solution
531 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Kamran,

Have you verified the ADC conversion time and the ISR duration? Have you checked the duration of the USB transmission function? On some USB tasks, the interrupts are disabled, and during such time, the ADC interrupts will not be serviced. So, you could try implementing DMA transfers for moving the ADC results to a memory buffer at the same time that the USB is transferring the data to the PC.


Hope this will be useful for you.
Best regards!
/Carlos

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

View solution in original post

0 Kudos
1 Reply
532 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Kamran,

Have you verified the ADC conversion time and the ISR duration? Have you checked the duration of the USB transmission function? On some USB tasks, the interrupts are disabled, and during such time, the ADC interrupts will not be serviced. So, you could try implementing DMA transfers for moving the ADC results to a memory buffer at the same time that the USB is transferring the data to the PC.


Hope this will be useful for you.
Best regards!
/Carlos

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

0 Kudos