LPC55x USB disables interrupts

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC55x USB disables interrupts

424 次查看
_Ferrari_
Contributor IV

Dear all,

I am using the LPC5528 microcontroller for an audio application that requires sampling digital inputs at 100 kHz and processing them in real time. To sample the signal, I am using a timer that generates a trigger for the analog-to-digital converter. The application also includes a USB VCOM connection to a PC. However, as soon as I connect the computer via USB, many samples are lost, even though the USB interrupt has a low priority.

Analyzing the code, it seems that the USB handling routines disable all interrupts to protect critical sections of the code.

How can I solve this problem?

Thank you very much for your help and cooperation

regards

标签 (2)
0 项奖励
回复
5 回复数

360 次查看
XuZhang
NXP Employee
NXP Employee

hi,_Ferrari_

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you, I will gladly help you with this.

I have done some tests using the LPC55S28 development board. I think the "lpcxpresso55s28_dev_cdc_vcom_bm" program in this SDK is more suitable for your application needs. You can refer to this demo, but the vcom routine in this program is self-transmitting and self-receiving (echo), and the data received by the virtual serial port is sent back intact. Therefore, when using this demo, it is necessary to decouple VCOM's Tx (transmit) and Rx (receive).

As you said, in this demo program, when the device receives data from the PC (host), it will disable all interrupts to protect the Copy Buffer to Send Buff code from interrupt interference. Please make sure that you have avoided the host from sending data to the device during the sampling process, or removed these codes.

XuZhang_0-1721897505199.png

At the same time, you can set the sampling flag in the position shown in the figure below to transmit data from the device to the host.

XuZhang_1-1721897511908.png

Wish it helps you.

If you still have question about it,please kindly let me know.

BR

Xu Zhang

0 项奖励
回复

306 次查看
_Ferrari_
Contributor IV

Thank you for your reply.
Following your suggestion, I've separated the USB data transmission and reception routines and eliminated the function calls that disable and enable interrupts, but the issue persists.
Could there be other function calls within the USB driver that disable interrupts?
Thank you very much for your assistance and collaboration.

0 项奖励
回复

253 次查看
XuZhang
NXP Employee
NXP Employee

hi,_Ferrari_

Regarding your issue that the ADC lost data when the USB is working, it is possible that the core is overloaded.

in order to reduce the core workload, I suggest you use ADC FIFO and set the watermark of FIFO to maximum, in the ISR, you read the number of ADC results in FIFO, then read them in one ISR, in this way, you can reduce the ADC ISR frequency and reduce the core workload.

Secondly, pls try to reduce the ADC triggering frequency so that the core workload can be reduced.

Hope it can help you

BR

Xu Zhang

0 项奖励
回复

240 次查看
_Ferrari_
Contributor IV

What you suggested has already been fully developed. In fact, I'm sampling all ten ADC channels at 100KHz and storing the results in the FIFO whose watermark is 9.
At the end of the conversion, the ADC interrupt is generated during which the samples must be processed. Even though the clock frequency is 144MHz, the processing time is quite long. Any delay causes data loss.

Thank you very much for your help and cooperation

regards

 

0 项奖励
回复

182 次查看
XuZhang
NXP Employee
NXP Employee

hi,_Ferrari_

Glad to help you.

BR

Xu Zhang

0 项奖励
回复