Good day All,
Most of my projests to date have been on Arduino Nano hardware using AVR-GCC and libraries I have borrowed from Dean etc. or rolled on my own, and most (all) to date have an active serial interface for interracting and debugging.
But, my latest projest I want to be able to run with or without a 'client' serial device attached, but without the serial plugged in the device doesn't start! This is using the usb->serial via *not* an FTDI (clone/replacement/PL...).
Can anyone advise as to how to change my USART code to allow transmission without a reciever?
Here are the relevent bits:
/* usart enable send/recv mode: 8N1 @ baude */ void init_usart(uint16_t baude, uint32_t fcpu) { UCSR0B = (1 << RXEN0) | (1 << TXEN0) | (1 << RXCIE0); UCSR0C = (1 << UCSZ00) | (1 << UCSZ01); UBRR0 = fcpu / 16 / baude - 1; } /* write a single byte to the usart */ void send_char(uint8_t byte) { while (!(UCSR0A & (1<<UDRE0))); UDR0 = byte; }
In my mainloop after initialisation I send a message saying welcome to this blah that version whatsits... the micro waits until I have done something like "screen /dev/ttyUSB*" and the screen session starts before t progresses.
Cheers.
Jasper