Home >Class April 25 Assignment
Made the 'bus' boards and compiled the code.

After that i found that RC-oscillator calibration was off again. The nodes received, but only a garbled responce was received.
I used my logic analyser to find the baud rate they were actually communicating at (10100 instead of 9600)

To fix this i changed the baud-rate in my serial-terminal program. After this i could successfully communicate with my boards.
While i was figuring out the actual communication speed, i noticed that the code was sending an extra byte (0x00) after 'node '
The source of this issue was located in the put_string method. This method checked if the last byte was '0x00' (termination of a string), but only after is was actually send. (see at +7ms below)

I updated this code as below.
void put_string(volatile unsigned char *port, unsigned char pin, PGM_P str) {
//
// send character in txchar on port pin
// assumes line driver (inverts bits)
//
static char chr;
static int index;
index = 0;
while (1) {
chr = pgm_read_byte(&(str[index]));
if (chr==0) break;
put_char(&serial_port, serial_pin_out, chr);
++index;
}
}
Now this code loops over the string's chars and only prints them if they are not '0x00' (see captured result below)
