LPC55x USB disables interrupts

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC55x USB disables interrupts

578件の閲覧回数
_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 件の賞賛
返信
6 返答(返信)

514件の閲覧回数
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 件の賞賛
返信

460件の閲覧回数
_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 件の賞賛
返信

407件の閲覧回数
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 件の賞賛
返信

394件の閲覧回数
_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 件の賞賛
返信

336件の閲覧回数
XuZhang
NXP Employee
NXP Employee

hi,_Ferrari_

Glad to help you.

BR

Xu Zhang

0 件の賞賛
返信

116件の閲覧回数
_Ferrari_
Contributor IV

I fixed the problem modifying USB routines.

Regards

0 件の賞賛
返信