I set up a ZX328n, 28-pin ATmega328p, on a bread board and it loaded and ran the sample "Hello World" program first time.
The power comes from a Basic Serial USB module from Sparkfun. I added a power switch and it did not shut it off.
When i removed 5 volts, by taking out the jumper wire, it still worked.
After probing i found that the chip had 3.5 volts on it being sourced from pin-20 of the device, AVCC which was connected to the VCC pin of the chip.
The chip was making its own power and working fine at 14... MHz. The Hello World was sending its message to the debug window of the IDE and all was looking good.
After disconnecting most every pin i found that the serial input to the device, which was not being used while the program ran, was leaking current into the device causing the device to output 3.5 volts and work just fine.
I disconnect the serial input, pin-2, and now the devices powers down when +5 volts is switched off.
Anyone have such and experience before?
Richard
ZX328n device strange behavior
Re: ZX328n device strange behavior
This is a well known phenomenon on devices that have protection diodes on their inputs.rich wrote:i found that the serial input to the device, [...] was leaking current into the device [...]
You can better understand what is happening by studying the equivalent circuit for an I/O pin, reproduced in the attached image excerpted from the mega328P datasheet (but common to most, if not all, AVR devices). The upper protection diode has its cathode connected to the Vcc bus of the device thus allowing a signal applied to the I/O pin to power the chip through the protection diode.
The other fact that helps explain what you observed is that RS-232 signals idle in the "marking" or "logic high" state. For a TTL-level RS-232 signal the idle state would be 4 to 5 volts or so so the chip would be powered one diode drop below that level.
- Attachments
-
- IO_pin.jpg (19.65 KiB) Viewed 3210 times
- Don Kinzer
Now i have gotten the baud rates of the target different than the IDE.
I was wondering if i could get the debug.print to run at 115200 so i set the Execution Option in the Serial Port option dialog to 115200.
I compiled, built, and go and then the Hello World comes out mush. So i changed the number back to 9600, the original value, compiled, built, and go and still the baud rate are mismatched.
The code download and verifies each time no matter what the Execution Option baud rate is.
How do i get both the IDE and target to talk the same baud rate?
Thanks
I was wondering if i could get the debug.print to run at 115200 so i set the Execution Option in the Serial Port option dialog to 115200.
I compiled, built, and go and then the Hello World comes out mush. So i changed the number back to 9600, the original value, compiled, built, and go and still the baud rate are mismatched.
The code download and verifies each time no matter what the Execution Option baud rate is.
How do i get both the IDE and target to talk the same baud rate?
Thanks
The default console speed on the ZX devices is 19,200 baud so if you change the Execution Baud Rate to 19,200 it should work fine.rich wrote:How do i get both the IDE and target to talk the same baud rate?
If you want to use a different console speed, you have to change it in the application and make a matching change in the IDE. The directive for changing the console speed in the application is Option ConsoleSpeed as described on the manual page below.
http://www.zbasic.net/doc/ZBasicRef.php?page=26
If you want the console speed to be 115200 you would use
Code: Select all
Option ConsoleSpeed 115200
Downloading the application to the device is done at a pre-determined speed that is unaffected by any of the changes described above. That's why downloading worked even though the application console output was garbled.
- Don Kinzer