Two quickies re Mega32

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

1. The Atmel data sheet for the mega32 says that UCSRC in the USART defines an 8 bit character in asynch mode as 11 in bits 2 and 1. However, I seem to need 0 in that whole register to make the transmit work at all. It's as if the Atmel data sheet is wrong on how to setup for 8 bit characters. Anyone know?

2. The serial port flash memory downloader from Progressive Resources LLC works fine. But a small hex file for a 1600 byte program = 100 lines of hex data, takes much longer that I'd expect, by far. What is the speed for other downloaders?

TIA
steve

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

1. Here is a little piece of my code for setting up Mega32 USART in a couple of different ways (for Modbus RTU). Remember the high bit must be set when dealing with the register as UCSRC.

if (xxxxxxxxxxxxxxxxxx)
{
// Even parity -- 8 data bits, parity bit, 1 stop bit
UCSRC = 0x26 | BIT_UCSRC_URSEL;
}
else
{
// No parity -- 8 data bits, no parity, 2 stop bits
UCSRC = 0x0e | BIT_UCSRC_URSEL;
}

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

Thanks. Program works now. I had that consant already - but for some reason it didn't initialize correctly after the bootstrap program ended, unless I put in a 1 second delay until reinitialing the USART vs. how the bootloader left it.

still don't understad why the bootloader takes so long to download code.
I'm wondering if some bootloader other than Progressive Resources is much faster.

A 100 line hex file takes 35 seconds to download at 19.2Kbaud.
Complier says this was a 1600 byte program. I'm new to this, but from the specs, it looks like about 4mSec per 256 byte page, am I correct?