Use ADC of the SAMR34

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

Hello everyone,

 

I just bought a ATSAMR34 Xplained Pro User in order to test the SAMR34.

I would like to test the ADC integrated in the SAMR34.

I didn't find any examples in the SAMR34 package in AtmelStudio in order to test the ADC.

Any idea where I can find this?

 

Thanks in advance.

Regards,

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

Hi,

 

Have you tried looking into start.atmel.com , It has plenty of example. maybe not for the exact devkit but you can find something close to it.

 

Regards,

Moe

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

Thank you for your reply.

I tried to check the website but I didn't find any example for the SAMR34 module. 

What I tried to do is test an example of the SAML21 module. This module is integrated in the SAMR34.

But the problem is that the board that I have doesn't have all the pins connected to the SAML21. 

 

In addition to that, if I check the examples of the pack manager in AtmelStudio, there are several examples of drivers for the SAMR34 module but not the ADC driver.

I dont know if it's not supported or there is a problem with that. But normally it should be supported as mentioned in the datasheet.

 

Regards,

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

as I can see from the datasheet of the devkit, its based on  ATSAMR34J18B and it has ADC. check the datasheet. it has 8 eight external ADC channels. for this you need to dig a bit on the datasheet how to initialize ADC and so on. 

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

Hello,

 

After digging the documentation of the SAML21, I succeeded to use the ADC of the SAMR34 module.

I have a problem regarding the value of the reference voltage.

Based on the API of the ADC, it is possible to have an external or internal reference.

But the problem is that when I try to apply 3.3V on the PA04 pin (it is the VREFB pin) of the board and I choose "ADC_REFERENCE_AREFB" value for the referene, The ADC stop working.

I want the ADC to have a range value between 0V and 3.3V. So I confiugred the single ended mode usage and I should apply 3.3V as the reference voltage.

Any ideas?

 

Thanks in advance.

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

antonyab wrote:
The ADC stop working.

What do you mean by stop working?

What value does the ADC return?   What were you expecting?

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
https://www.onegold.com/join/7134f67c2b814c5ca8144a458eccfd61

 

 

 

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

I am debugging using tera term.

When I apply 3.3V on pa04, I dont receive anything from serial.

I just verified the pa04 pin, it can play also the role of uart pin. I think that's why I am not receiving anything on the serial.

Any idea how I can fix the problem and use the pa04 pin as VrefB instead of uart? 

 

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

antonyab wrote:
dont receive anything from serial.
Surely there's code in your own program that read ADC, converts binary to ASCII, then sends to UART. It doesn't just happen by magic so presumably it's something wrong in the logic of your code? After reading the UART do you have some send/don't send decision logic based on the value that was read perhaps?

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

Jim disappeared! Haha.

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

I think I explained for you why I am not receiving on serial. It is not by magic.

The pin PA04 can be used by UART or by VrefB. So when I apply 3.3V for example on this pin, the serial will not work anymore.

My question was if there is a way to use this pin only for VrefB.

Anw I solved my problem by sending the value using lorawan. With this method, I can see the value of the ADC on the server.