ATmega328PB, energy cost of UART

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

 

 Greetings, colleagues,

 

 This is a part of a bigger work that compares energy cost of different ways of communications
between SMU and DUT: GPIO, USART etc.
 HW:
 -Linux PC;
 -Qoitech Otii Arc as SMU;
 -Atmel ATmega328PB Xplained Mini as DUT;
 -AtmelICE as ISP programmer.
 SW:
 -Otii PC SW to control SMU and display recordings;
 -custom program for 328.

Connections between SMU and DUT

 328 wakes up every 1 s on timer interrupt. On each wakeup it sends a string to SMU. String length
varies in cycles from 2 to 11.
 Looking at the recordings of current drain I've noticed several things that I can not explain
at the moment:

UART0 Tx at 9600

 1. The longer is the string, the higher is maximal current. See impulses on the upper pane and
their corresponding UART messages below. Maximal current for a pulse grows for string lengths from
two through six and stops at 12.8 mA for seven chars and longer strings (up to 11, did not test
it for longer strings).
 Looks like short strings are sent before power system starts up completely? Then it appears that
we start sending too early?

Sending a 6-char string at 9600 and 38400

 2. Maximal current is lower for faster UART speeds. For 38400 (red line) it's 1.5 mA less
than for 9600 (green line) on a six-char string.
 This I don't understand. Either something obvious or I'm measuring/interpreting it wrong.
 Has anyone seen the same? Can confirm? Explain?

PS

 Source code, hi-res images and recordings made by SMU can be found in attachment.

Attachment(s): 

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

I would suspect part of the differences may be that initial current draw will provided by the on board caps and then as those are discharged, the system begins drawing power from the external sources...

David (aka frog_jr)

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

 

 David,

 

Sounds reasonable, thanks. I'll add a 15 s delay, ie 5 s for mEDBG to shut down and 10 more for the capacitors to discharge and we'll see.

 

 Ed

 

 

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

I am not sure the delays you are going to change the results appreciably.

 

At 9600, a 10-bit character (start, 8 data, stop) will take about 1ms.

At 38400, it will take about 260us.

The initial peak for the 9600 current appears to be about 6ms wide and the 38400 appears to be about 4ms wide.

 

The on board 100nF capacitors are responding (typically) in nano seconds to smooth out the current spikes that would be occurring on the signal edge transitions.

And depending on where/how you are measuring, there is also the 4.7uF on the VCC_P5V0 power.

 

I do not believe the system you are using (if it samples at 4 ksps and has an analog bandwith of 400Hz) will accurately capture the current transients in this environment.

 

Edit: strike through typo

 

 

David (aka frog_jr)

Last Edited: Wed. Oct 4, 2017 - 04:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

frog_jr wrote:
... from the external sources...
the SMU.

What's uncertain is the mega328PB can be powered by 5V or by the 3.3V 150mA LDO; the default is 5V via USB VBUS or Arduino 5V.

 

ATmega328PB Xplained Mini

User Guide

http://ww1.microchip.com/downloads/en/DeviceDoc/50002660A.pdf

(page 18)

4.1 Power Sources

via

Microchip Technology Inc

Microchip

ATmega328PB Xplained Mini

http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=ATMEGA328PB-XMINI

 

Edit : default

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Oct 4, 2017 - 08:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Source code, hi-res images and recordings made by SMU can be found in attachment.

I don't do tar.

 

I got DUT, but what is SMU?  [Google search seemed to find meanings NSFW]

 

From the board User Guide and the picture, you are connecting PD1 with the yellow wire to the "Otii".  What are the characteristics of that input?  Do you get the same results with the yellow wire disconnected, and the USART sending "to air"?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Don't the datasheet answer this question?

 

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

"Dare to be naïve." - Buckminster Fuller

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

gchapman wrote:

theusch wrote:
... what is SMU?
Source Measure Unit

http://www.mouser.com/Test-Measurement/Source-Measure-Units-SMUs/_/N-bdf1y/

 

Not Solid waste Management Unit?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

 Heh, no. I have one similar to what you've mentioned, but it's not likely to be controlled by an Atmel MCU. It's just a big pit..

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

ki0bk wrote:

Don't the datasheet answer this question?

...

 

Well, not completely, alas. What we can't figure looking at the table:

-will additional consumption change if we enable only Tx?

-will it change if USART is idle/transmitting?

-should we limit our messages to 1-2 chars or can send something more informative?

 

 

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

theusch wrote:

Source code, hi-res images and recordings made by SMU can be found in attachment.

I don't do tar.

 

I got DUT, but what is SMU?  [Google search seemed to find meanings NSFW]

 

From the board User Guide and the picture, you are connecting PD1 with the yellow wire to the "Otii".  What are the characteristics of that input?  Do you get the same results with the yellow wire disconnected, and the USART sending "to air"?

 

 I can re-pack it with another archiver if you want. Just let me know.

Tried sending with no receiving party, the same result for both observations. Maximal current grows with message length and maximal current for 38400 is higher than for 9600 for any length.

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

Yabusame wrote:
Either something obvious ...
The PD1 (mega328PB TXD) signal is to the SMU and to the mega32U4.

mega328PB and mega32U4 (mEDBG, USB CDC ACM) share 5V power that's measured by the SMU.

IIRC, UART TXD will go via USB CDC ACM if the USB is connected to a USB host (Windows Virtual COM)

 

http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328PB-Xplained-Mini_Design-Documentation.zip (schematic PDF, pages 2 and 3)

 

Edit : URL

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Oct 5, 2017 - 05:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

frog_jr wrote:

I am not sure the delays you are going to change the results appreciably.

At 9600, a 10-bit character (start, 8 data, stop) will take about 1ms.

At 38400, it will take about 260us.

The initial peak for the 9600 current appears to be about 6ms wide and the 38400 appears to be about 4ms wide.

The on board 100nF capacitors are responding (typically) in nano seconds to smooth out the current spikes that would be occurring on the signal edge transitions.

And depending on where/how you are measuring, there is also the 4.7uF on the VCC_P5V0 power.

I do not believe the system you are using (if it samples at 4 ksps and has an analog bandwith of 400Hz) will accurately capture the current transients in this environment.

 

 Sorry, I first though about charge/discharge at power on.

 I have 34465A here too so it's possible to verify at higher sampling rates.

 OIK. Do you mean that for shorter messages we go to sleep before capacitors have fully charged?

 

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

gchapman wrote:

Yabusame wrote:
Either something obvious ...
The PD1 (mega328PB TXD) signal is to the SMU and to the mega32U4.

mega328PB and mega32U4 (mEDBG, USB CDC ACM) share 5V power that's measured by the SMU.

IIRC, UART TXD will go via USB CDC ACM if the USB is connected to a USB host (Windows Virtual COM)

 

http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328PB-Xplained-Mini_Design-Documentation.zip (schematic PDF, pages 2 and 3)

 

Edit : URL

 

 

 SMU provides 3.3V to VIN. Xplained Mini is configured as 3V3/VIN (see the jumpers). 32U4 is off. USB cable not connected to the board.

 

 

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

theusch wrote:
I don't do tar.
Windows users probably use WinZip or 7-Zip or WinRAR to handle .zip files. At least two of these (the last 2) and probably all three will happily open .tar.gz archives.

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

 

Yabusame wrote:
Maximal current is lower for faster UART speeds. For 38400 (red line) it's 1.5 mA less than for 9600 (green line) on a six-char string.
Yabusame wrote:
... maximal current for 38400 is higher than for 9600 for any length.

These statements appear to be contradictory...

 

What I "think" you are seeing is that the current spikes due to 38400 transmission are occurring much faster than your system is capable of measuring.

I also "think" the current spikes due to 9600 transmission are also faster than your system is capable of measuring.

 

 

David (aka frog_jr)

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

frog_jr wrote:

 

Yabusame wrote:
Maximal current is lower for faster UART speeds. For 38400 (red line) it's 1.5 mA less than for 9600 (green line) on a six-char string.
Yabusame wrote:
... maximal current for 38400 is higher than for 9600 for any length.

These statements appear to be contradictory...

 

 A typo, sorry.

 

frog_jr wrote:

 

What I "think" you are seeing is that the current spikes due to 38400 transmission are occurring much faster than your system is capable of measuring.

I also "think" the current spikes due to 9600 transmission are also faster than your system is capable of measuring.

 

 

 Yes. DMMs are slow. 200 us is the fastest my 34465A can do.

 Nevertheless, we see something. It is not those 100 nF capacitors because we just can't see them. What is it, then?

 Doesn't seem to be parts of 328 waking up because UART Tx is available much earlier than our envelope reaches it's maximum of 12.9 mA. Looks pretty much like a bigger capacitor.

 Need to try it with standalone power supply and DMM, just in case.