SAMR34 X PRO DEV KIT ADC & UART Example Code

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

Hi Everyone, 

 

I am trying to figure out how to use the ADC within the SAMR34 and print the readings (I am using Atmel Studio & ASF).

 

Here is a tutorial for another board (SAM4N, this is what I am trying to achieve) :

https://startingelectronics.org/software/atmel/asf-arm-tutorial/adc/ 

 

Does anyone have an example code to share? 

 

Thanks! 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This does not have code for the SAMR34 unfortunately, but the SAMR34 is quite similar to the D21/L21 as far as adc reading I'm pretty sure. Couldn't find anything on R34 =/

 

https://github.com/ataradov/mcu-starter-projects (not my git repo!)

im a penguin

Last Edited: Mon. Feb 17, 2020 - 06:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't see you were using ASF. You can generate examples for the R34. If you want a quick solution, generate example projects for the D(or L)21 using USART, and then another for the ADC. They both use SERCOMs so the code will be extremely similar. Here is something from from mine: 

 

https://github.com/adragott/SAMD21_LEARNING/blob/master/USART_QUICK_START_CALLBACK1/src/qs_usart_callback.c

 

Here's an adc example, but its old and for the d21, but again, code will be similar. If I were you I would ignore this and just generate an adc example from asf for clarity. I also have a DMA ADC example somewhere on my github if you wanna try that

https://github.com/adragott/temp_arm_drivers/blob/master/skywave_prototype_arm/src/drivers/ntcle100.c

im a penguin

Last Edited: Mon. Feb 17, 2020 - 06:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!
I've been trying to use the basic code examples from the Microchip ASF libs, I have a working code for the ADC and one for the UART which prints some strings to screen ...

Now, I am trying to combine them into one code ...
(to print the ADC values), I am not quite sure if that what's your code is doing ? Have you seen the link that I've attached to my first post ?

Cheers