Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #31849
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: UART connection between ATSAMD20 and ATtiny4313 |
| Date | 2023-04-27 09:17 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <u2d7ih$1qmgf$1@dont-email.me> (permalink) |
| References | <u2be3n$1a5nq$1@dont-email.me> <8c53b82a-f075-4b51-98bd-792221acbe60n@googlegroups.com> <u2c2eu$1hfgr$2@dont-email.me> <3400c428-350a-4826-adc8-df2c6105fc8bn@googlegroups.com> |
On 27/04/2023 02:10, Rick C wrote: > I don't think the software UART is a lot of code, but you don't need > that. You need to write a routine to measure a bit time on the input > to calibrate your clock to the incoming bit times. That should not > be a lot of code. Translating a loop count into a bit clock setting > for the UART should be a simple linear relationship, although it may > involve a divide. You only need to work over a small range, so a > small table lookup should be pretty close to optimal solution. > That's definitely one way to do it, yes. Have the master side send a couple of 0x00 bytes before the data, and use an interrupt on the Rx pin falling edge - when that comes in, count the time until a rising edge is seen. If that time works out to within 10% of the nominal expected time, you are calibrated and can turn off the interrupt. Alternatively, send 0x55 bytes first and measure multiple short periods. There will be some details to work out, depending on the what you are sending, the type of noise you expect, how often you need to re-calibrate, etc. You are making a software equivalent to a PLL. There's no need for a lookup table here (unless I've got my calculations upside down!). The more cycles you count for the incoming trainer characters, the bigger the UART divider value you need. That means your divisions will be done with constant values, and the compiler will turn those into multiplies. An alternative is trial and error. If your clock source is ±10%, and you need to get within ±2%, start your UART at the nominally correct baud rate. If you don't receive error-free telegrams within a timeout, go 2% faster. Keep adding 2%, stepping from +10% to -10%, until you hit a baud rate that works. You can get even fancier here by figuring out the lowest and highest rates that work, then picking their average to get the best value.
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-04-26 16:56 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-26 17:57 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-04-26 22:40 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Grant Edwards <invalid@invalid.invalid> - 2023-04-26 21:00 +0000
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-26 17:20 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-04-27 10:15 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-26 09:26 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-04-26 22:44 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-26 17:10 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-27 09:17 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-04-27 10:28 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Andrew Smallshaw <andrews@sdf.org> - 2023-04-27 13:28 +0000
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-27 09:22 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-28 09:48 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-28 01:55 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2023-04-27 20:18 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 Ulf Samuelsson <ulf.r.samuelsson@gmail.com> - 2023-04-27 23:03 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2023-04-28 09:58 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-27 17:45 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2023-04-28 10:00 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-28 00:21 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2023-04-28 11:43 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 Ulf Samuelsson <ulf.r.samuelsson@gmail.com> - 2023-04-28 11:10 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2023-04-28 17:26 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-28 02:14 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-28 02:19 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-28 14:51 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-28 16:41 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-29 18:01 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-30 02:37 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-27 09:02 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-28 15:01 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-04-28 16:44 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-04-29 17:59 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-03 18:16 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-03 09:40 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-04 10:34 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-05-04 12:31 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-05 10:51 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-05-05 12:59 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-05 18:01 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Dimiter_Popoff <dp@tgi-sci.com> - 2023-05-05 19:52 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-07 23:20 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-05 11:37 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-07 23:21 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-05-08 08:37 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-08 09:24 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Grant Edwards <invalid@invalid.invalid> - 2023-05-05 20:16 +0000
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-07 23:17 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-07 14:27 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 David Brown <david.brown@hesbynett.no> - 2023-05-08 08:34 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Dimiter_Popoff <dp@tgi-sci.com> - 2023-05-08 13:46 +0300
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-08 09:38 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Grant Edwards <invalid@invalid.invalid> - 2023-05-08 14:12 +0000
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-08 18:13 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-08 11:39 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-09 17:04 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-09 14:32 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-10 08:55 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Grant Edwards <invalid@invalid.invalid> - 2023-05-08 19:09 +0000
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-09 17:08 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-08 07:32 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-08 18:27 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-08 11:52 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-09 16:52 +0200
Re: UART connection between ATSAMD20 and ATtiny4313 Grant Edwards <invalid@invalid.invalid> - 2023-05-09 15:10 +0000
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-09 14:29 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 Rick C <gnuarm.deletethisbit@gmail.com> - 2023-05-04 06:21 -0700
Re: UART connection between ATSAMD20 and ATtiny4313 pozz <pozzugno@gmail.com> - 2023-05-05 11:02 +0200
csiph-web