Skip to content

Commit

Permalink
Don't do the BRG divisor analysis for SOFT_UART targets.
Browse files Browse the repository at this point in the history
(and improve the check that does happen for SOFT_UART.)
  • Loading branch information
WestfW committed Oct 7, 2018
1 parent bd451cf commit b1b8977
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions optiboot/bootloaders/optiboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,11 @@ include Makefile.2560
include Makefile.tiny
include Makefile.MCUdude

BAUDCHECK=
ifndef PRODUCTION
ifndef SOFT_UART
BAUDCHECK= baudcheck
else
BAUDCHECK=
endif
endif

#---------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions optiboot/bootloaders/optiboot/optiboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ typedef union {
#define UART 0
#endif

#ifndef SOFT_UART
#ifdef SINGLESPEED
/* Single speed option */
#define BAUD_SETTING (( (F_CPU + BAUD_RATE * 8L) / ((BAUD_RATE * 16L))) - 1 )
Expand Down Expand Up @@ -364,6 +365,7 @@ typedef union {
#error Unachievable baud rate (too fast) BAUD_RATE
#endif
#endif // baud rate fast check
#endif // SOFT_UART

/* Watchdog settings */
#define WATCHDOG_OFF (0)
Expand Down Expand Up @@ -982,6 +984,13 @@ uint8_t getch(void) {
#if UART_B_VALUE > 255
#error Baud rate too slow for soft UART
#endif
#if UART_B_VALUE < 6
// (this value is a "guess" at when loop/call overhead might become too
// significant for the soft uart to work. It tests OK with the popular
// "ATtinycore" chips that need SOFT_UART, at the usual clock/baud combos.)
#error Baud rate too high for soft UART
#endif


void uartDelay() {
__asm__ __volatile__ (
Expand Down

0 comments on commit b1b8977

Please sign in to comment.