SAMD21 USB CDC check if character received ASF3 vs START

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear all,

 

I am an occasional user of SAMD21 and I am not an expert.

I have an application where reading data from ADC via SPI and sending it further to PC via USB CDC.

Everything as fast as possible without interruption, as ADC data must be acquired in precise time intervals and with SAMD21.

Occasionally ADC settings can be changed during the operation by sending them from PC. In such event, data acquisition interruption is allowed.

in ASF3 there was a function called   "udi_cdc_is_rx_ready()" to check if there is any data from PC waiting on port.

Now in ASF4 I can not find such function.

 

I am also thinking of how to trigger an interrupt when there is data sent from PC

 

Any help is appreciated.

 

Kind regards,

Andrej

 

Last Edited: Fri. Feb 19, 2021 - 09:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SmrkecPRO wrote:
thinking of  how to trigger an interrupt when there is data sent from PC

Might be better to think in terms of a Callback function?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...