ATmega32M1 - ISRC current source peripheral and excess pin voltage - Page 1
Forum section: electronics / general

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 15, 2018, 12:41:28 pm
content: The ATmega32M1 has a current source peripheral that can output a constant 100uA current from its ISRC pin. It also has a dedicated ADC channel for reading the voltage at the ISRC pin.I was looking into hooking up the ISRC output to a potentiometer, and then using the ADC to read the position of the pot. I was planning on using a 47K pot, getting me a max voltage of 4.7V. However, the thought occurred that of course following V=IR, if a resistive load greater than 50K is attached to the ISRC pin, can the voltage at the pin go higher than 5V?I'm guessing... probably not? Because the supply for the current source is AVCC, which like the supply to the entire chip, is no more than 5V?There's little detail in the ATmega32M1 datasheet regarding this, save for the following snippet:QuoteI'm not sure what exactly they mean by "protect the device"?Ifthe current source's pin voltage is incapable of going above AVCC, why would they say that? To my knowledge, it's fine for an input voltage to an AVR's ADC to be > AREF, so long as it is <= VCC. On the other hand, if itcanexceed AVCC, how is changing the AREF going to protect anything?Adding further confusion, later in the ISRC section (where they give an example of using an external resistor to set a LIN bus address according to the ADC reading) there is a table giving typical voltages for various external resistor values with this note following it:QuoteWhy would they say max 30K? That's only 3V input to the ADC...So I don't know if I what I plan to do is okay or not, or if I need to protect the ISRC ADC input from excess resistance/voltages or not. If I did need to, I suppose a diode would do? Either a schottky to VCC, or a 5.1V zener to ground?

author: mikerj
author_rank: Super Contributor
timestamp: January 15, 2018, 04:04:17 pm
content: Quote from: HwAoRrDk on January 15, 2018, 12:41:28 pmIf a current source is powered from a 5v supply, how could it's output exceed 5v? The answer is that it can not. Any current source will have a limited output voltage range, known as thecompliance range.Quote from: HwAoRrDk on January 15, 2018, 12:41:28 pmThat bit of text in the datasheet is gibberish, it sounds like it was written by an intern with poor English skills. The resistance limits are likely due to the compliance of the current source, i.e. the maximum voltage it can deliver whilst still delivering a constant current. This will always be somewhat less than the supply rail voltage, sometimes significantly less.They are suggesting you use AVCC as a reference for the first reading in case the voltage on the IREF pin exceeds the internal reference voltage. If the result shows the voltage is lower than Vref, then you can take a second reading using Vref to get increased resolution.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 15, 2018, 04:21:16 pm
content: Quote from: mikerj on January 15, 2018, 04:04:17 pmThat's what I thought! But then I read that paragraph saying "protect the device" in the datasheet and started to doubt myself.Quote from: mikerj on January 15, 2018, 04:04:17 pmAh, I see. If that were the case, it would be helpful if they would actually state that, rather than just hint at it in a footnote for a table of examples. I couldn't find anything describing the characteristics of the current source in the Electrical Characteristics section of the datasheet at all. Maybe I will have to reconsider what value of potentiometer to use. Or maybe just try it and see if the current dips under loads > 30K.Thanks for the help.

author: mikerj
author_rank: Super Contributor
timestamp: January 16, 2018, 09:42:44 am
content: I couldn't find any specification on the current source either. I think it's safe to say that isn't one of their better datasheets!