I have some problem with reading string from program memory:
const char str[] PROGMEM = "Test string here\r\n";
Here are my printing routines:
/** Send string over UART */
void uart_puts(char* str)
{
while (*str) {
uart_tx(*str++);
}
}
/** Send progmem string over UART */
void uart_puts_pgm(const char* str)
{
char c;
while (0 != (c = pgm_read_byte(&str))) {
uart_tx(c);
str++;
}
}
The normal one works just fine, but the progmem one prints infinite stream of 0xFF
. Where is the mistake?
I've worked with progmem before, and it always worked.. I can't seem to find the problem here.