Closed swissiety closed 1 year ago
Hello Markus,
Thanks for your interest in this little project !
I recognized, that the bootloader uses softuart while the main program uses usiart for communication - as im quite new to electronics I'd like to ask you to elaborate why it is that way. Thank you in advance.
There was some reasons behind, the hardest was the first one:
The usiart
requires interrupts & fixed interrupt vectors with routines while softuart
is free of such.
usiart
use interrupts (3 of them) and must be shared somehow between main
& boot
(difficult & messy)softuart
, and anything in boot
code does not use any kind of interrupts thus is completley independent.boot
means one can swap on the fly back-forth from boot<->main without issues, it is flexible.boot
have only one single task: to wait the octets on wire for firmware flashing so softuart
is fine for this.The usiart
had a limitation when used on lower speeds like 9600, a safe limit for firmware upgrading.
usiart
is not even a complete uart
it is more like a serdes
needing 3 interrupts to handle e.g. 8N1 frames.usiart
is even bigger (due to many handlers) making it a bad candidate against softuart
.usiart
or a any real uart
is mandatory in main
to offload comm from CPU, due to variety of tasks done here.If one's concern is stability booth usiuart
and softuart
offer exact same stability except that that main clock is RC (internal) and not a real crystal since attiny85 have very limited physical pins.
Now, one can port it to a more beefy attiny having stable crystal and real `usart
, but hey: this was the real challenge :)
Some deployments have ~5 years of continuous readings, exceeding my expectations, they did very well in bad weather too.
Cheers, ~Cristian.
Hello, thank you for providing this nice project for us to adapt and learn. While exploring the code I recognized, that the bootloader uses softuart while the main program uses usiart for communication - as im quite new to electronics I'd like to ask you to elaborate why it is that way. Thank you in advance.