• UART connection between ATSAMD20 and ATtiny4313

    From pozz@21:1/5 to All on Wed Apr 26 16:56:55 2023
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to
    reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the
    range 0-80°C.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to pozz on Wed Apr 26 17:57:21 2023
    On 26/04/2023 16:56, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the range 0-80°C.

    The rule of thumb is a maximum of 5% total mismatch in baud rates
    between the two sides. One side has a crystal and PLL, so it will be
    quite close - that means you can have most of the error margin on the
    other side. If the internal oscillator is within 2%, you should be
    fine. If it is 5% or more, you will want to do some automatic
    measurement of the rate.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to pozz on Wed Apr 26 09:26:06 2023
    On Wednesday, April 26, 2023 at 10:57:01 AM UTC-4, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the range 0-80°C.

    I don't get what your question is. You seem to understand the concepts. You don't tell us the relevant data however. What does the data sheet say about the frequency variability of the internal clock over PVT (process, voltage and temperature)? I
    assume you are aware that the 3.3V supply will have an accuracy and an RC clock rate can be voltage dependent. It depends on how they designed the circuit. There are techniques for removing most of the voltage dependency, if they used them.

    You can always use the bit times of the SAM to adjust the bit rate on the ATtiny. That used to be part of the protocol for low data rate modems. The first characters sent were AT if I recall, which give good edges to time to measure the bit rate. At
    38400 bps this might be a bit tricker, it depends on your instruction rate. A bit time is just 26 us. Will this be a software UART, or a hardware unit?

    --

    Rick C.

    - Get 1,000 miles of free Supercharging
    - Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Wed Apr 26 22:44:13 2023
    Il 26/04/2023 18:26, Rick C ha scritto:
    On Wednesday, April 26, 2023 at 10:57:01 AM UTC-4, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to
    reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over
    temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the
    range 0-80°C.

    I don't get what your question is. You seem to understand the concepts. You don't tell us the relevant data however. What does the data sheet say about the frequency variability of the internal clock over PVT (process, voltage and temperature)? I
    assume you are aware that the 3.3V supply will have an accuracy and an RC clock rate can be voltage dependent. It depends on how they designed the circuit. There are techniques for removing most of the voltage dependency, if they used them.

    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of ±10% at Vcc=3V and 25°C temperature. This accuracy can be reduced to ±2% at a fixed voltage and a fixed
    temperature with a user calibration.


    You can always use the bit times of the SAM to adjust the bit rate on the ATtiny. That used to be part of the protocol for low data rate modems. The first characters sent were AT if I recall, which give good edges to time to measure the bit rate. At
    38400 bps this might be a bit tricker, it depends on your instruction rate. A bit time is just 26 us. Will this be a software UART, or a hardware unit?


    I will use the interal UART peripheral of ATtiny4313. I can't add too
    much code, the Flash memory is almost full. I wanted to know if the
    figures shown on the datasheet guarantee good communication between the
    the MCUs. It seems this isn't the case.


    [1] https://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Wed Apr 26 22:40:29 2023
    Il 26/04/2023 17:57, David Brown ha scritto:
    On 26/04/2023 16:56, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by
    the SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL
    to reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related
    to the internal oscillator of ATtiny4313 that hasn't a good accuracy
    over temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in
    the range 0-80°C.

    The rule of thumb is a maximum of 5% total mismatch in baud rates
    between the two sides.  One side has a crystal and PLL, so it will be
    quite close - that means you can have most of the error margin on the
    other side.  If the internal oscillator is within 2%, you should be
    fine.  If it is 5% or more, you will want to do some automatic
    measurement of the rate.


    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of +/-10% at Vcc=3V and 25°C temperature.
    This accuracy can be reduced to +/-2% at a fixed voltage and a fixed temperature with a user calibration.

    I could calibrate for a fixed voltage (3.3V), but I can't fix a
    temperature, because it can vary in the real application.

    I tried to heat the ATtiny4313 with a heat gun and the communication
    between SAM and tiny didn't stopped, but I know this isn't an exaustive
    test.


    [1] https://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Edwards@21:1/5 to pozz on Wed Apr 26 21:00:16 2023
    On 2023-04-26, pozz <pozzugno@gmail.com> wrote:

    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of +/-10% at Vcc=3V and 25°C temperature.

    10% total error (combination of both ends) is pretty much right at the
    limit according to the usual rule of thumb for UART receivers that
    sync only on the start bit. IIRC, there used to be UART receivers that
    would sync on every edge within the data "word" as well, but I don't
    think that was ever very common -- and to take advantage of it, you
    had to make sure your data had edges. :)

    Can you spare a line for a clock and go synchronous? (Or are they
    really UARTs and not USARTs?).

    This accuracy can be reduced to +/-2% at a fixed voltage and a fixed temperature with a user calibration.

    2% is no problem at all. With a crystal on the other end, you should
    be able to easily tolerate +/-5%. The requirement for a fixed
    temperature, OTOH, is usually a problem.

    I could calibrate for a fixed voltage (3.3V), but I can't fix a
    temperature, because it can vary in the real application.

    Does the ATtiny have an on-die temp sensor? If yes, you could try characterizing the oscillator over temperature at 3.3V and adjusting
    the baud rate divisor as the temperature changes. That get's expensive
    if you have to do it on every unit during production, but if the T/F
    curve is consistent enough between units, then maybe...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to pozz on Wed Apr 26 17:10:53 2023
    On Wednesday, April 26, 2023 at 4:44:20 PM UTC-4, pozz wrote:
    Il 26/04/2023 18:26, Rick C ha scritto:
    On Wednesday, April 26, 2023 at 10:57:01 AM UTC-4, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the >> SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to >> reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to >> the internal oscillator of ATtiny4313 that hasn't a good accuracy over
    temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the >> range 0-80°C.

    I don't get what your question is. You seem to understand the concepts. You don't tell us the relevant data however. What does the data sheet say about the frequency variability of the internal clock over PVT (process, voltage and temperature)? I
    assume you are aware that the 3.3V supply will have an accuracy and an RC clock rate can be voltage dependent. It depends on how they designed the circuit. There are techniques for removing most of the voltage dependency, if they used them.
    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of ±10% at Vcc=3V and 25°C temperature. This accuracy can be reduced to ±2% at a fixed voltage and a fixed
    temperature with a user calibration.

    Ok, that is information. Do you have a question?


    You can always use the bit times of the SAM to adjust the bit rate on the ATtiny. That used to be part of the protocol for low data rate modems. The first characters sent were AT if I recall, which give good edges to time to measure the bit rate. At
    38400 bps this might be a bit tricker, it depends on your instruction rate. A bit time is just 26 us. Will this be a software UART, or a hardware unit?

    I will use the interal UART peripheral of ATtiny4313. I can't add too
    much code, the Flash memory is almost full. I wanted to know if the
    figures shown on the datasheet guarantee good communication between the
    the MCUs. It seems this isn't the case.


    [1] https://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf

    You point me to a data sheet. I am not reading the data sheet to do your work for you. I'm happy to discuss the information and offer advice and opinion. The info you provide above with the 2% stability if temperature and voltage are maintained and
    the clock calibrated, is not enough to know if this will work.

    When you write, "It seems this isn't the case.", what do you base this on? What is your reasoning?

    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.

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    --

    Rick C.

    + Get 1,000 miles of free Supercharging
    + Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to Grant Edwards on Wed Apr 26 17:20:53 2023
    On Wednesday, April 26, 2023 at 5:00:22 PM UTC-4, Grant Edwards wrote:
    On 2023-04-26, pozz <pozz...@gmail.com> wrote:

    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of +/-10% at Vcc=3V and 25°C temperature.
    10% total error (combination of both ends) is pretty much right at the
    limit according to the usual rule of thumb for UART receivers that
    sync only on the start bit.

    I think you are not doing the calculation right. The limit is based on the UART trying to sample in the middle of a bit. If it gets out by a half a bit time, either way, it will sample the wrong bit. With 10 bits in the character, including start and
    stop bits, that puts the total error limit at about 5%. This is actually closer to 5.5% (because while it is 10 bits, it's only 9 bit times between start and stop bits), but then you need to subtract a fraction of a bit for the internal Nx clock used to
    sample the bit stream. So round off to 5%. That's the total error allowed, including both ends. Then there's distortion in the pulse edges. With 26 us bit times, there may be issues with asymmetric edge distortion. There has been no mention of the
    electrical interface.


    IIRC, there used to be UART receivers that
    would sync on every edge within the data "word" as well, but I don't
    think that was ever very common -- and to take advantage of it, you
    had to make sure your data had edges. :)

    Can you spare a line for a clock and go synchronous? (Or are they
    really UARTs and not USARTs?).
    This accuracy can be reduced to +/-2% at a fixed voltage and a fixed temperature with a user calibration.
    2% is no problem at all. With a crystal on the other end, you should
    be able to easily tolerate +/-5%. The requirement for a fixed
    temperature, OTOH, is usually a problem.
    I could calibrate for a fixed voltage (3.3V), but I can't fix a temperature, because it can vary in the real application.
    Does the ATtiny have an on-die temp sensor? If yes, you could try characterizing the oscillator over temperature at 3.3V and adjusting
    the baud rate divisor as the temperature changes. That get's expensive
    if you have to do it on every unit during production, but if the T/F
    curve is consistent enough between units, then maybe...

    Calibration, in general is expensive. But yes, a calibration curve is worse, since you need to wait for temperature to adjust.

    --

    Rick C.

    -- Get 1,000 miles of free Supercharging
    -- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Rick C on Thu Apr 27 09:17:36 2023
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Thu Apr 27 10:15:36 2023
    Il 26/04/2023 23:00, Grant Edwards ha scritto:
    On 2023-04-26, pozz <pozzugno@gmail.com> wrote:

    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of +/-10% at Vcc=3V and 25°C temperature.

    10% total error (combination of both ends) is pretty much right at the
    limit according to the usual rule of thumb for UART receivers that
    sync only on the start bit. IIRC, there used to be UART receivers that
    would sync on every edge within the data "word" as well, but I don't
    think that was ever very common -- and to take advantage of it, you
    had to make sure your data had edges. :)

    Can you spare a line for a clock and go synchronous? (Or are they
    really UARTs and not USARTs?).

    No, I can't. The MCUs are not on the same board and they are really
    connected through RS485 half-duplex transceivers.


    This accuracy can be reduced to +/-2% at a fixed voltage and a fixed
    temperature with a user calibration.

    2% is no problem at all. With a crystal on the other end, you should
    be able to easily tolerate +/-5%. The requirement for a fixed
    temperature, OTOH, is usually a problem.

    I could calibrate for a fixed voltage (3.3V), but I can't fix a
    temperature, because it can vary in the real application.

    Does the ATtiny have an on-die temp sensor? If yes, you could try characterizing the oscillator over temperature at 3.3V and adjusting
    the baud rate divisor as the temperature changes. That get's expensive
    if you have to do it on every unit during production, but if the T/F
    curve is consistent enough between units, then maybe...

    Thank you for this suggestion, but I can't use this trick.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Thu Apr 27 10:28:23 2023
    Il 27/04/2023 02:10, Rick C ha scritto:
    On Wednesday, April 26, 2023 at 4:44:20 PM UTC-4, pozz wrote:
    Il 26/04/2023 18:26, Rick C ha scritto:
    On Wednesday, April 26, 2023 at 10:57:01 AM UTC-4, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the >>>> SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to >>>> reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to >>>> the internal oscillator of ATtiny4313 that hasn't a good accuracy over >>>> temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the >>>> range 0-80°C.

    I don't get what your question is. You seem to understand the concepts. You don't tell us the relevant data however. What does the data sheet say about the frequency variability of the internal clock over PVT (process, voltage and temperature)? I
    assume you are aware that the 3.3V supply will have an accuracy and an RC clock rate can be voltage dependent. It depends on how they designed the circuit. There are techniques for removing most of the voltage dependency, if they used them.
    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of ±10% at Vcc=3V and 25°C temperature. This >> accuracy can be reduced to ±2% at a fixed voltage and a fixed
    temperature with a user calibration.

    Ok, that is information. Do you have a question?


    You can always use the bit times of the SAM to adjust the bit rate on the ATtiny. That used to be part of the protocol for low data rate modems. The first characters sent were AT if I recall, which give good edges to time to measure the bit rate. At
    38400 bps this might be a bit tricker, it depends on your instruction rate. A bit time is just 26 us. Will this be a software UART, or a hardware unit?

    I will use the interal UART peripheral of ATtiny4313. I can't add too
    much code, the Flash memory is almost full. I wanted to know if the
    figures shown on the datasheet guarantee good communication between the
    the MCUs. It seems this isn't the case.


    [1] https://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf

    You point me to a data sheet. I am not reading the data sheet to do your work for you.

    And I don't want you do it if you don't want. The datasheet link is
    there if someone WANTS to look at it with a single click of the mouse.


    I'm happy to discuss the information and offer advice and opinion. The info you provide above with the 2% stability if temperature and voltage are maintained and the clock calibrated, is not enough to know if this will work.

    When you write, "It seems this isn't the case.", what do you base this on? What is your reasoning?

    Because internal oscillator has an accuracy of 10% and I read that UART receivers are usually able to decode the input signal with an error of
    2-5% order.

    However I tested one sample at high temperature, but the MCUs continued communicating well.


    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.

    Ok, thanks for suggestion.


    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Smallshaw@21:1/5 to pozz on Thu Apr 27 13:28:27 2023
    On 2023-04-27, pozz <pozzugno@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.

    --
    Andrew Smallshaw
    andrews@sdf.org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to pozz on Thu Apr 27 09:02:41 2023
    On Thursday, April 27, 2023 at 4:28:29 AM UTC-4, pozz wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:
    On Wednesday, April 26, 2023 at 4:44:20 PM UTC-4, pozz wrote:
    Il 26/04/2023 18:26, Rick C ha scritto:
    On Wednesday, April 26, 2023 at 10:57:01 AM UTC-4, pozz wrote:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the >>>> SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will >>>> use an external 32.768kHz crystal (that is multiplied by internal PLL to
    reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to >>>> the internal oscillator of ATtiny4313 that hasn't a good accuracy over >>>> temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the
    range 0-80°C.

    I don't get what your question is. You seem to understand the concepts. You don't tell us the relevant data however. What does the data sheet say about the frequency variability of the internal clock over PVT (process, voltage and temperature)? I
    assume you are aware that the 3.3V supply will have an accuracy and an RC clock rate can be voltage dependent. It depends on how they designed the circuit. There are techniques for removing most of the voltage dependency, if they used them.
    ATtiny4313 datasheet[1] says the internal oscillator is factory
    calibrated with an accuracy of ±10% at Vcc=3V and 25°C temperature. This
    accuracy can be reduced to ±2% at a fixed voltage and a fixed
    temperature with a user calibration.

    Ok, that is information. Do you have a question?


    You can always use the bit times of the SAM to adjust the bit rate on the ATtiny. That used to be part of the protocol for low data rate modems. The first characters sent were AT if I recall, which give good edges to time to measure the bit rate.
    At 38400 bps this might be a bit tricker, it depends on your instruction rate. A bit time is just 26 us. Will this be a software UART, or a hardware unit?

    I will use the interal UART peripheral of ATtiny4313. I can't add too
    much code, the Flash memory is almost full. I wanted to know if the
    figures shown on the datasheet guarantee good communication between the >> the MCUs. It seems this isn't the case.


    [1] https://ww1.microchip.com/downloads/en/DeviceDoc/doc8246.pdf

    You point me to a data sheet. I am not reading the data sheet to do your work for you.
    And I don't want you do it if you don't want.

    I'm glad we are in agreement. My point is you could have pointed us to any useful info in the document, or better quoted it, if there was anything you had not already quoted. I find CPU data sheets to be rather onerous to read, as they have so much
    data in them these days, and they don't always put timing data in the timing section, for example.


    The datasheet link is
    there if someone WANTS to look at it with a single click of the mouse.
    I'm happy to discuss the information and offer advice and opinion. The info you provide above with the 2% stability if temperature and voltage are maintained and the clock calibrated, is not enough to know if this will work.

    When you write, "It seems this isn't the case.", what do you base this on? What is your reasoning?
    Because internal oscillator has an accuracy of 10% and I read that UART receivers are usually able to decode the input signal with an error of
    2-5% order.

    The 10% was for a fixed voltage and temperature without calibration. I don't recall if you are adverse to calibration. But you do have a wide temperature range which is an issue.


    However I tested one sample at high temperature, but the MCUs continued communicating well.

    That means pretty much nothing. While testing can prove that something doesn't work, it can't prove that it does.

    Instead of simply testing pass/fail, it would have been more useful to measure the clock rate, by measuring the bit rate over temperature. Get some numbers for multiple units to see what sort of spread you get.


    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.
    Ok, thanks for suggestion.
    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?
    No, this isn't an option.

    You can't add a crystal? Then the two workable choices would appear to be calibration of each unit over temperature, or a real time calibration from the data rate of the incoming data. I can't think of any other solutions. Adding the crystal seems the
    simple route.

    --

    Rick C.

    -+ Get 1,000 miles of free Supercharging
    -+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to Andrew Smallshaw on Thu Apr 27 09:22:12 2023
    On Thursday, April 27, 2023 at 9:28:33 AM UTC-4, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.
    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.

    What about Manchester encoding is not RS-485? That's just an electrical interface standard, no?

    But that is a great idea... if the hardware will accommodate it. Or this can be done in the UART using a faster clock and synchronous mode. Send characters with one data bit per character, the Manchester encoded bit, x0F or xF0. It would not be
    terribly hard to decode the data in software.. possibly. I believe you align to the transition that is always present mid-cell, then look for the presence/absence of the other transition. The OP talked about the "small" processor being program space
    constrained, but again, this is not a lot of code... maybe. So maybe this will be too much. But it would solve the clocking issue. Then again, so would a crystal.

    --

    Rick C.

    +- Get 1,000 miles of free Supercharging
    +- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tauno Voipio@21:1/5 to Andrew Smallshaw on Thu Apr 27 20:18:53 2023
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozzugno@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.


    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer
    counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    --

    -TV

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulf Samuelsson@21:1/5 to All on Thu Apr 27 23:03:14 2023
    Den 2023-04-27 kl. 19:18, skrev Tauno Voipio:
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozzugno@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a
    crystal to the ATtiny. Can the SAM chip send a clock?  You can use
    an SPI port instead of a UART, or just send a clock to use for the
    bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal.  Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates.  Manchester coding
    is fine provided the clocks are within 2:1 of each other.  You will
    need to bit-bang the interface though, the UART won't handle it.


    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    Atmel implemented Manchester Coding in the SAM7 USART (My proposal)
    but the SAMD20 has a "SERCOM" module without Manchester Coding.
    I would look into the event system.


    The tiny will have to do it in S/W.
    /Ulf


    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.


    The SAM4E USART supports Manchester Coding in H/W.
    The SAM4E UART does not.

    /Ulf

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to Tauno Voipio on Thu Apr 27 17:45:09 2023
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote:
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART can be used to send the bits as characters at the transmitter. A USART can be used to handle the reception with software seeking edges. I don't think that would be a huge burden at 38.
    4 kbps. But then, I'm more used to FPGA work.

    --

    Rick C.

    ++ Get 1,000 miles of free Supercharging
    ++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tauno Voipio@21:1/5 to Rick C on Fri Apr 28 10:00:37 2023
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote:
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer
    counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART can be used to send the bits as characters at the transmitter. A USART can be used to handle the reception with software seeking edges. I don't think that would be a huge burden at
    38.4 kbps. But then, I'm more used to FPGA work.


    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    --

    -TV

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tauno Voipio@21:1/5 to Ulf Samuelsson on Fri Apr 28 09:58:24 2023
    On 28.4.2023 0.03, Ulf Samuelsson wrote:
    Den 2023-04-27 kl. 19:18, skrev Tauno Voipio:
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozzugno@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a
    crystal to the ATtiny. Can the SAM chip send a clock?  You can use
    an SPI port instead of a UART, or just send a clock to use for the
    bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal.  Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates.  Manchester coding
    is fine provided the clocks are within 2:1 of each other.  You will
    need to bit-bang the interface though, the UART won't handle it.


    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    Atmel implemented Manchester Coding in the SAM7 USART (My proposal)
    but the SAMD20 has a "SERCOM" module without Manchester Coding.
    I would look into the event system.


    The tiny will have to do it in S/W.
    /Ulf


    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer
    counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.


    The SAM4E USART supports Manchester Coding in H/W.
    The SAM4E UART does not.

    /Ulf


    The problem with the USART Manchester coder was in address markers
    (intentional mis-codings). It was not possible to conform with the
    markers in the IEC coding.

    --

    -TV

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to Tauno Voipio on Fri Apr 28 00:21:01 2023
    On Friday, April 28, 2023 at 3:00:45 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote:
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer
    counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART can be used to send the bits as characters at the transmitter. A USART can be used to handle the reception with software seeking edges. I don't think that would be a huge burden at
    38.4 kbps. But then, I'm more used to FPGA work.
    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    I did a Google search and this didn't return anything useful. So I don't know for certain what an IEC H1 standard address marker octet is, but if I'm specifying the waveform, rather than relying on the hardware to do the Manchester encoding, I can't see
    a reason why I could not transmit any given waveform. Can you point me to something that describes these marker octets?

    --

    Rick C.

    --- Get 1,000 miles of free Supercharging
    --- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Rick C on Fri Apr 28 09:48:27 2023
    On 27/04/2023 18:22, Rick C wrote:
    On Thursday, April 27, 2023 at 9:28:33 AM UTC-4, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.
    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.

    What about Manchester encoding is not RS-485? That's just an electrical interface standard, no?


    Technically, you are correct. In reality, the term "RS-485" is usually
    used to mean "UART signalling on an RS-485 bus" - any other kind of
    signalling (such as Manchester encoding) would be specified explicitly.
    It's good to be technically accurate, but also good to consider less
    accurate common usage of terms.

    But that is a great idea... if the hardware will accommodate it. Or
    this can be done in the UART using a faster clock and synchronous
    mode. Send characters with one data bit per character, the
    Manchester encoded bit, x0F or xF0. It would not be terribly hard to
    decode the data in software.. possibly. I believe you align to the transition that is always present mid-cell, then look for the presence/absence of the other transition. The OP talked about the
    "small" processor being program space constrained, but again, this is
    not a lot of code... maybe. So maybe this will be too much. But it
    would solve the clocking issue. Then again, so would a crystal.


    Not all microcontroller UARTs have synchronous modes. Receiving or
    sending Manchester encoded data with a UART is fiddly because of the
    start and stop bits of UART, so it is often done by bit-banging.
    Whether or not that suits the OP, only he can say.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tauno Voipio@21:1/5 to Rick C on Fri Apr 28 11:43:04 2023
    On 28.4.2023 10.21, Rick C wrote:
    On Friday, April 28, 2023 at 3:00:45 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote:
    On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested
    bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester >>>> coded bus at 31.25 kbit/s. The trick was to innovatively use the timer >>>> counter units of the chip. A timer used to measure the times between
    pulse edges could be used to receive and decode the incoming data, and >>>> a timer running at half of the bit rate (15.625 kbit/s) could be used
    to send the data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART can be used to send the bits as characters at the transmitter. A USART can be used to handle the reception with software seeking edges. I don't think that would be a huge burden at
    38.4 kbps. But then, I'm more used to FPGA work.
    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    I did a Google search and this didn't return anything useful. So I don't know for certain what an IEC H1 standard address marker octet is, but if I'm specifying the waveform, rather than relying on the hardware to do the Manchester encoding, I can't
    see a reason why I could not transmit any given waveform. Can you point me to something that describes these marker octets?

    The H1 bus is an industrial fieldbus and technical information about
    it has been notoriously difficult to access.

    The Manchester coding in the H1 bus is sent as current variations,
    which are converted into voltage variations for receiving.

    I'll show the more positive voltage with a plus sign and the less
    positive voltage with a minus sign.

    A state pair takes one bit time (32 us) with the change at the middle.

    A data bit of '1' is sent as +-
    A data bit of '0' is sent as -+

    There are two intentional miscodings for delimiters:

    A coding N+ is sent as ++
    A coding N- is sent as --

    A frame starts with a preamble of alternating 0's and 1's:

    1 0 1 0 1 0 1 0 1 0

    After preamble a start delimiter is sent:

    1 N+ N- 1 0 N- N+ 0

    The packet content follows, with most significant bit first.

    After last data octet an end delimiter is sent:

    1 N+ N- N+ N- 1 0 1

    After the packet the transmitter is switched off, so the line
    will stay halfway between the + and - states.

    The processor chip Manchester coders could not be twisted to
    handle the start end end delimiters correctly.

    --

    -TV

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to David Brown on Fri Apr 28 01:55:45 2023
    On Friday, April 28, 2023 at 3:48:32 AM UTC-4, David Brown wrote:
    On 27/04/2023 18:22, Rick C wrote:
    On Thursday, April 27, 2023 at 9:28:33 AM UTC-4, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.
    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding
    is fine provided the clocks are within 2:1 of each other. You will
    need to bit-bang the interface though, the UART won't handle it.

    What about Manchester encoding is not RS-485? That's just an electrical interface standard, no?

    Technically, you are correct. In reality, the term "RS-485" is usually
    used to mean "UART signalling on an RS-485 bus" - any other kind of signalling (such as Manchester encoding) would be specified explicitly.
    It's good to be technically accurate, but also good to consider less accurate common usage of terms.

    Not technically, actually. "Wouldn't be true RS485" is a very clear statement, which happens to also be wrong, no matter how hands are waved.


    But that is a great idea... if the hardware will accommodate it. Or
    this can be done in the UART using a faster clock and synchronous
    mode. Send characters with one data bit per character, the
    Manchester encoded bit, x0F or xF0. It would not be terribly hard to decode the data in software.. possibly. I believe you align to the transition that is always present mid-cell, then look for the presence/absence of the other transition. The OP talked about the
    "small" processor being program space constrained, but again, this is
    not a lot of code... maybe. So maybe this will be too much. But it
    would solve the clocking issue. Then again, so would a crystal.

    Not all microcontroller UARTs have synchronous modes.

    I never said anything different.


    Receiving or
    sending Manchester encoded data with a UART is fiddly because of the
    start and stop bits of UART, so it is often done by bit-banging.
    Whether or not that suits the OP, only he can say.

    It is simply not practical to send Manchester encoding with a UART... but Manchester is not the only encoding scheme that embeds a clock. Or you can roll your own. The point is, clock encoding with the data is a viable method of overcoming the lack of
    precision in the clock rate, which does not require bit banging an I/O pin. The encoding scheme of IRIG is a real possibility. The data bits are PWM encoded, with three values; 0.2, 0.5 and 0.8 widths for 0, 1 and a sync marker. This would fit a UART
    very nicely. With a distinction of symbols of 0.3 bit times, it can tolerate a lot more clock error than a typical async data stream with a start and stop bit on each character. It would also be pretty easy to decode. Align to the rising edge, and
    count the bits in the received data to find the falling edge. 0.1, 0.2 and 0.3 are all a zero bit. 0.4, 0.5 and 0.6 are all one bits. 0.7, 0.8 and 0.9 are all sync markers. To prevent the UART from missing anything important, set it for 7 data bits
    and no parity on receive. Then it always stops one bit early. Then if the timing is off by 10%, you still don't lose any data. This can be better than using a USART, actually. It does the alignment in the hardware, making the decoding simpler. It
    also includes a sync marker.

    Yeah, I think this is a much better scheme than Manchester encoding.

    --

    Rick C.

    --+ Get 1,000 miles of free Supercharging
    --+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulf Samuelsson@21:1/5 to All on Fri Apr 28 11:10:29 2023
    Den 2023-04-28 kl. 10:43, skrev Tauno Voipio:
    On 28.4.2023 10.21, Rick C wrote:
    On Friday, April 28, 2023 at 3:00:45 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote: >>>>> On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a
    crystal to the ATtiny. Can the SAM chip send a clock? You can
    use an SPI port instead of a UART, or just send a clock to use >>>>>>>> for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding >>>>>> is fine provided the clocks are within 2:1 of each other. You will >>>>>> need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested >>>>> bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester >>>>> coded bus at 31.25 kbit/s. The trick was to innovatively use the timer >>>>> counter units of the chip. A timer used to measure the times between >>>>> pulse edges could be used to receive and decode the incoming data, and >>>>> a timer running at half of the bit rate (15.625 kbit/s) could be used >>>>> to send the data. The receiver needed to respond to interrupts at the >>>>> incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART
    can be used to send the bits as characters at the transmitter. A
    USART can be used to handle the reception with software seeking
    edges. I don't think that would be a huge burden at 38.4 kbps. But
    then, I'm more used to FPGA work.
    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    I did a Google search and this didn't return anything useful.  So I
    don't know for certain what an IEC H1 standard address marker octet
    is, but if I'm specifying the waveform, rather than relying on the
    hardware to do the Manchester encoding, I can't see a reason why I
    could not transmit any given waveform.  Can you point me to something
    that describes these marker octets?

    The H1 bus is an industrial fieldbus and technical information about
    it has been notoriously difficult to access.

    The Manchester coding in the H1 bus is sent as current variations,
    which are converted into voltage variations for receiving.

    I'll show the more positive voltage with a plus sign and the less
    positive voltage with a minus sign.

    A state pair takes one bit time (32 us) with the change at the middle.

    A data bit of '1' is sent as +-
    A data bit of '0' is sent as -+

    There are two intentional miscodings for delimiters:

    A coding N+ is sent as ++
    A coding N- is sent as --

    A frame starts with a preamble of alternating 0's and 1's:

    1 0 1 0 1 0 1 0 1 0

    After preamble a start delimiter is sent:

    1 N+ N- 1 0 N- N+ 0

    The packet content follows, with most significant bit first.

    After last data octet an end delimiter is sent:

    1 N+ N- N+ N- 1 0 1

    After the packet the transmitter is switched off, so the line
    will stay halfway between the + and - states.

    The processor chip Manchester coders could not be twisted to
    handle the start end end delimiters correctly.


    If the bus speed is known, this packet seems overkill.
    It can be used to detect the BAUD rate.

    The Atmel USART is designed to use a 9-bit mode for packet data, with
    the 9th bit set for addresses.

    /Ulf.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to Tauno Voipio on Fri Apr 28 02:14:44 2023
    On Friday, April 28, 2023 at 4:43:13 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 10.21, Rick C wrote:
    On Friday, April 28, 2023 at 3:00:45 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote: >>>> On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding >>>>> is fine provided the clocks are within 2:1 of each other. You will >>>>> need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested >>>> bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester >>>> coded bus at 31.25 kbit/s. The trick was to innovatively use the timer >>>> counter units of the chip. A timer used to measure the times between >>>> pulse edges could be used to receive and decode the incoming data, and >>>> a timer running at half of the bit rate (15.625 kbit/s) could be used >>>> to send the data. The receiver needed to respond to interrupts at the >>>> incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART can be used to send the bits as characters at the transmitter. A USART can be used to handle the reception with software seeking edges. I don't think that would be a huge burden at
    38.4 kbps. But then, I'm more used to FPGA work.
    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    I did a Google search and this didn't return anything useful. So I don't know for certain what an IEC H1 standard address marker octet is, but if I'm specifying the waveform, rather than relying on the hardware to do the Manchester encoding, I can't
    see a reason why I could not transmit any given waveform. Can you point me to something that describes these marker octets?
    The H1 bus is an industrial fieldbus and technical information about
    it has been notoriously difficult to access.

    The Manchester coding in the H1 bus is sent as current variations,
    which are converted into voltage variations for receiving.

    I'll show the more positive voltage with a plus sign and the less
    positive voltage with a minus sign.

    A state pair takes one bit time (32 us) with the change at the middle.

    A data bit of '1' is sent as +-
    A data bit of '0' is sent as -+

    There are two intentional miscodings for delimiters:

    A coding N+ is sent as ++
    A coding N- is sent as --

    A frame starts with a preamble of alternating 0's and 1's:

    1 0 1 0 1 0 1 0 1 0

    After preamble a start delimiter is sent:

    1 N+ N- 1 0 N- N+ 0

    The packet content follows, with most significant bit first.

    After last data octet an end delimiter is sent:

    1 N+ N- N+ N- 1 0 1

    After the packet the transmitter is switched off, so the line
    will stay halfway between the + and - states.

    The processor chip Manchester coders could not be twisted to
    handle the start end end delimiters correctly.

    Yes, my point is you can run the USART at a higher rate and send data as x0F, xF0, x00 or xFF. You can use the hardware without a hardware Manchester encoder.

    Actually, I think Manchester encoding is inferior to the scheme they use in the IRIG signal (also the WWVB time broadcast). I don't know if that PWM scheme has a particular name, but it is very robust and can be implemented with a UART, so no USART
    required. The UART aligns to the start of the bit frame, so less work in the software. It becomes a matter of recognizing which of the 7 bit patterns are received. You really only need to look at two bit positions to distinguish the three values.

    --

    Rick C.

    -+- Get 1,000 miles of free Supercharging
    -+- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to Rick C on Fri Apr 28 02:19:18 2023
    On Friday, April 28, 2023 at 5:14:48 AM UTC-4, Rick C wrote:
    On Friday, April 28, 2023 at 4:43:13 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 10.21, Rick C wrote:
    On Friday, April 28, 2023 at 3:00:45 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote: >>>> On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a crystal to the ATtiny. Can the SAM chip send a clock? You can use an SPI port instead of a UART, or just send a clock to use for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through >>>>> transceivers and cabling at sensible baud rates. Manchester coding >>>>> is fine provided the clocks are within 2:1 of each other. You will >>>>> need to bit-bang the interface though, the UART won't handle it. >>>> I doubt that the ATTiny can handle Manchester coding at the requested >>>> bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1 Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the timer
    counter units of the chip. A timer used to measure the times between >>>> pulse edges could be used to receive and decode the incoming data, and
    a timer running at half of the bit rate (15.625 kbit/s) could be used >>>> to send the data. The receiver needed to respond to interrupts at the >>>> incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART can be used to send the bits as characters at the transmitter. A USART can be used to handle the reception with software seeking edges. I don't think that would be a huge burden
    at 38.4 kbps. But then, I'm more used to FPGA work.
    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    I did a Google search and this didn't return anything useful. So I don't know for certain what an IEC H1 standard address marker octet is, but if I'm specifying the waveform, rather than relying on the hardware to do the Manchester encoding, I can'
    t see a reason why I could not transmit any given waveform. Can you point me to something that describes these marker octets?
    The H1 bus is an industrial fieldbus and technical information about
    it has been notoriously difficult to access.

    The Manchester coding in the H1 bus is sent as current variations,
    which are converted into voltage variations for receiving.

    I'll show the more positive voltage with a plus sign and the less
    positive voltage with a minus sign.

    A state pair takes one bit time (32 us) with the change at the middle.

    A data bit of '1' is sent as +-
    A data bit of '0' is sent as -+

    There are two intentional miscodings for delimiters:

    A coding N+ is sent as ++
    A coding N- is sent as --

    A frame starts with a preamble of alternating 0's and 1's:

    1 0 1 0 1 0 1 0 1 0

    After preamble a start delimiter is sent:

    1 N+ N- 1 0 N- N+ 0

    The packet content follows, with most significant bit first.

    After last data octet an end delimiter is sent:

    1 N+ N- N+ N- 1 0 1

    After the packet the transmitter is switched off, so the line
    will stay halfway between the + and - states.

    The processor chip Manchester coders could not be twisted to
    handle the start end end delimiters correctly.
    Yes, my point is you can run the USART at a higher rate and send data as x0F, xF0, x00 or xFF. You can use the hardware without a hardware Manchester encoder.

    Actually, I think Manchester encoding is inferior to the scheme they use in the IRIG signal (also the WWVB time broadcast). I don't know if that PWM scheme has a particular name, but it is very robust and can be implemented with a UART, so no USART
    required. The UART aligns to the start of the bit frame, so less work in the software. It becomes a matter of recognizing which of the 7 bit patterns are received. You really only need to look at two bit positions to distinguish the three values.

    Sorry, two points to distinguish the three values encoded in the eight possible received bit patterns using a 7 bit character.

    --

    Rick C.

    -++ Get 1,000 miles of free Supercharging
    -++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Rick C on Fri Apr 28 15:01:02 2023
    On 27/04/2023 18:02, Rick C wrote:
    On Thursday, April 27, 2023 at 4:28:29 AM UTC-4, pozz wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a
    crystal to the ATtiny. Can the SAM chip send a clock? You can use
    an SPI port instead of a UART, or just send a clock to use for
    the bit rate clock in the UART?
    No, this isn't an option.

    You can't add a crystal? Then the two workable choices would appear
    to be calibration of each unit over temperature, or a real time
    calibration from the data rate of the incoming data. I can't think
    of any other solutions. Adding the crystal seems the simple route.


    Perhaps he already has the boards produced - adding a crystal is then a
    rather difficult task! Even if the design is not completed, the Tiny is
    a very small, cheap and low power family. Adding a crystal makes the
    design bigger, more expensive and uses more power - assuming there are
    suitable pins free for connecting a crystal. Now, a small, cheap
    crystal might be $0.50 and just a few square millimetres, but so is a
    small AVR Tiny. I don't know why the OP is using a a Tiny, but if it is
    for good technical or economic reasons, adding a crystal would work
    against it.

    Trial-and-error, as I suggested earlier, is another workable choice.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Rick C on Fri Apr 28 14:51:26 2023
    On 28/04/2023 02:45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote:

    In 2016, I made a processor unit using AT91SAM4E for IEC H1
    Manchester coded bus at 31.25 kbit/s. The trick was to innovatively
    use the timer counter units of the chip. A timer used to measure
    the times between pulse edges could be used to receive and decode
    the incoming data, and a timer running at half of the bit rate
    (15.625 kbit/s) could be used to send the data. The receiver needed
    to respond to interrupts at the incoming edge rate, and the
    transmitter needed to respond at the outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART
    can be used to send the bits as characters at the transmitter. A
    USART can be used to handle the reception with software seeking
    edges. I don't think that would be a huge burden at 38.4 kbps. But
    then, I'm more used to FPGA work.


    You certainly /can/ do this kind of thing in software on a Tiny.
    However, it might be a challenge depending on other factors. If the
    device already has high-precision timing requirements for another task,
    doing two of them can get complicated. If you need to deal with a lot
    of noise on the lines, that too is messy.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tauno Voipio@21:1/5 to Ulf Samuelsson on Fri Apr 28 17:26:35 2023
    On 28.4.2023 12.10, Ulf Samuelsson wrote:
    Den 2023-04-28 kl. 10:43, skrev Tauno Voipio:
    On 28.4.2023 10.21, Rick C wrote:
    On Friday, April 28, 2023 at 3:00:45 AM UTC-4, Tauno Voipio wrote:
    On 28.4.2023 3.45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote: >>>>>> On 27.4.2023 16.28, Andrew Smallshaw wrote:
    On 2023-04-27, pozz <pozz...@gmail.com> wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a >>>>>>>>> crystal to the ATtiny. Can the SAM chip send a clock? You can >>>>>>>>> use an SPI port instead of a UART, or just send a clock to use >>>>>>>>> for the bit rate clock in the UART?

    No, this isn't an option.

    The other option would be to adopt a Manchester-encoded (self
    clocking) signal. Wouldn't be true RS485 but would pass through
    transceivers and cabling at sensible baud rates. Manchester coding >>>>>>> is fine provided the clocks are within 2:1 of each other. You will >>>>>>> need to bit-bang the interface though, the UART won't handle it.
    I doubt that the ATTiny can handle Manchester coding at the requested >>>>>> bit rate, and it may be difficult for the SAM.

    In 2016, I made a processor unit using AT91SAM4E for IEC H1
    Manchester
    coded bus at 31.25 kbit/s. The trick was to innovatively use the
    timer
    counter units of the chip. A timer used to measure the times between >>>>>> pulse edges could be used to receive and decode the incoming data, >>>>>> and
    a timer running at half of the bit rate (15.625 kbit/s) could be used >>>>>> to send the data. The receiver needed to respond to interrupts at the >>>>>> incoming edge rate, and the transmitter needed to respond at the
    outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART
    can be used to send the bits as characters at the transmitter. A
    USART can be used to handle the reception with software seeking
    edges. I don't think that would be a huge burden at 38.4 kbps. But
    then, I'm more used to FPGA work.
    Had to bit-bang. The USART cannot create or detect IEC H1 standard
    address marker octets.

    I did a Google search and this didn't return anything useful.  So I
    don't know for certain what an IEC H1 standard address marker octet
    is, but if I'm specifying the waveform, rather than relying on the
    hardware to do the Manchester encoding, I can't see a reason why I
    could not transmit any given waveform.  Can you point me to something
    that describes these marker octets?

    The H1 bus is an industrial fieldbus and technical information about
    it has been notoriously difficult to access.

    The Manchester coding in the H1 bus is sent as current variations,
    which are converted into voltage variations for receiving.

    I'll show the more positive voltage with a plus sign and the less
    positive voltage with a minus sign.

    A state pair takes one bit time (32 us) with the change at the middle.

    A data bit of '1' is sent as +-
    A data bit of '0' is sent as -+

    There are two intentional miscodings for delimiters:

    A coding N+ is sent as ++
    A coding N- is sent as --

    A frame starts with a preamble of alternating 0's and 1's:

    1 0 1 0 1 0 1 0 1 0

    After preamble a start delimiter is sent:

    1 N+ N- 1 0 N- N+ 0

    The packet content follows, with most significant bit first.

    After last data octet an end delimiter is sent:

    1 N+ N- N+ N- 1 0 1

    After the packet the transmitter is switched off, so the line
    will stay halfway between the + and - states.

    The processor chip Manchester coders could not be twisted to
    handle the start end end delimiters correctly.


    If the bus speed is known, this packet seems overkill.
    It can be used to detect the BAUD rate.

    The Atmel USART is designed to use a 9-bit mode for packet data, with
    the 9th bit set for addresses.

    /Ulf.




    The packet structure and coding is set in the standard. An USART cannot
    create the bit patterns, even with fictive data, as there are fixed
    start and stop bit patterns.

    --

    -TV

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to David Brown on Fri Apr 28 16:44:01 2023
    On Friday, April 28, 2023 at 9:01:09 AM UTC-4, David Brown wrote:
    On 27/04/2023 18:02, Rick C wrote:
    On Thursday, April 27, 2023 at 4:28:29 AM UTC-4, pozz wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a
    crystal to the ATtiny. Can the SAM chip send a clock? You can use
    an SPI port instead of a UART, or just send a clock to use for
    the bit rate clock in the UART?
    No, this isn't an option.

    You can't add a crystal? Then the two workable choices would appear
    to be calibration of each unit over temperature, or a real time calibration from the data rate of the incoming data. I can't think
    of any other solutions. Adding the crystal seems the simple route.

    Perhaps he already has the boards produced - adding a crystal is then a rather difficult task! Even if the design is not completed, the Tiny is
    a very small, cheap and low power family. Adding a crystal makes the
    design bigger, more expensive and uses more power - assuming there are suitable pins free for connecting a crystal. Now, a small, cheap
    crystal might be $0.50 and just a few square millimetres, but so is a
    small AVR Tiny. I don't know why the OP is using a a Tiny, but if it is
    for good technical or economic reasons, adding a crystal would work
    against it.

    Trial-and-error, as I suggested earlier, is another workable choice.

    Yes, trial and error. I believe that's the design process recommended by NASA.

    WTF are you talking about? If he's designed the board without considering the requirements, that's a failure of the first order. If someone imposed new requirements on the design, that's a perfect justification to respin the board.

    Once again, not rocket science.

    --

    Rick C.

    +-+ Get 1,000 miles of free Supercharging
    +-+ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to David Brown on Fri Apr 28 16:41:37 2023
    On Friday, April 28, 2023 at 8:51:33 AM UTC-4, David Brown wrote:
    On 28/04/2023 02:45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio wrote:

    In 2016, I made a processor unit using AT91SAM4E for IEC H1
    Manchester coded bus at 31.25 kbit/s. The trick was to innovatively
    use the timer counter units of the chip. A timer used to measure
    the times between pulse edges could be used to receive and decode
    the incoming data, and a timer running at half of the bit rate
    (15.625 kbit/s) could be used to send the data. The receiver needed
    to respond to interrupts at the incoming edge rate, and the
    transmitter needed to respond at the outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The USART
    can be used to send the bits as characters at the transmitter. A
    USART can be used to handle the reception with software seeking
    edges. I don't think that would be a huge burden at 38.4 kbps. But
    then, I'm more used to FPGA work.

    You certainly /can/ do this kind of thing in software on a Tiny.
    However, it might be a challenge depending on other factors. If the
    device already has high-precision timing requirements for another task, doing two of them can get complicated. If you need to deal with a lot
    of noise on the lines, that too is messy.


    I don't think you understand the issues. If there is a lot of noise, the project is dead in the water regardless. Fix your noise problems.

    This does not impose "high-precision timing requirements" on the CPU. The only requirements are to handle the data without dropping. It's NOT bit banging, so there is lots of time to handle the data.

    If the CPU is overloaded, then you picked the wrong CPU. Get a faster one.

    Why are you bringing in all this silliness? It's almost as if you've never done design work.

    --

    Rick C.

    +-- Get 1,000 miles of free Supercharging
    +-- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Rick C on Sat Apr 29 17:59:53 2023
    On 29/04/2023 01:44, Rick C wrote:
    On Friday, April 28, 2023 at 9:01:09 AM UTC-4, David Brown wrote:
    On 27/04/2023 18:02, Rick C wrote:
    On Thursday, April 27, 2023 at 4:28:29 AM UTC-4, pozz wrote:
    Il 27/04/2023 02:10, Rick C ha scritto:

    I don't see where you have a choice, unless you want to add a
    crystal to the ATtiny. Can the SAM chip send a clock? You can use
    an SPI port instead of a UART, or just send a clock to use for
    the bit rate clock in the UART?
    No, this isn't an option.

    You can't add a crystal? Then the two workable choices would appear
    to be calibration of each unit over temperature, or a real time
    calibration from the data rate of the incoming data. I can't think
    of any other solutions. Adding the crystal seems the simple route.

    Perhaps he already has the boards produced - adding a crystal is then a
    rather difficult task! Even if the design is not completed, the Tiny is
    a very small, cheap and low power family. Adding a crystal makes the
    design bigger, more expensive and uses more power - assuming there are
    suitable pins free for connecting a crystal. Now, a small, cheap
    crystal might be $0.50 and just a few square millimetres, but so is a
    small AVR Tiny. I don't know why the OP is using a a Tiny, but if it is
    for good technical or economic reasons, adding a crystal would work
    against it.

    Trial-and-error, as I suggested earlier, is another workable choice.

    Yes, trial and error. I believe that's the design process recommended by NASA.


    Feel free to try /reading/ posts before making comments about them that
    show you up your ignorance.

    WTF are you talking about? If he's designed the board without considering the requirements, that's a failure of the first order. If someone imposed new requirements on the design, that's a perfect justification to respin the board.

    Once again, not rocket science.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Rick C on Sat Apr 29 18:01:46 2023
    On 29/04/2023 01:41, Rick C wrote:
    On Friday, April 28, 2023 at 8:51:33 AM UTC-4, David Brown wrote:
    On 28/04/2023 02:45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio
    wrote:

    In 2016, I made a processor unit using AT91SAM4E for IEC H1
    Manchester coded bus at 31.25 kbit/s. The trick was to
    innovatively use the timer counter units of the chip. A timer
    used to measure the times between pulse edges could be used to
    receive and decode the incoming data, and a timer running at
    half of the bit rate (15.625 kbit/s) could be used to send the
    data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at
    the outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The
    USART can be used to send the bits as characters at the
    transmitter. A USART can be used to handle the reception with
    software seeking edges. I don't think that would be a huge burden
    at 38.4 kbps. But then, I'm more used to FPGA work.

    You certainly /can/ do this kind of thing in software on a Tiny.
    However, it might be a challenge depending on other factors. If
    the device already has high-precision timing requirements for
    another task, doing two of them can get complicated. If you need to
    deal with a lot of noise on the lines, that too is messy.


    I don't think you understand the issues. If there is a lot of noise,
    the project is dead in the water regardless. Fix your noise
    problems.

    This does not impose "high-precision timing requirements" on the CPU.
    The only requirements are to handle the data without dropping. It's
    NOT bit banging, so there is lots of time to handle the data.

    If the CPU is overloaded, then you picked the wrong CPU. Get a
    faster one.

    Why are you bringing in all this silliness? It's almost as if you've
    never done design work.


    Have you heard the saying that it is better to keep quite and be thought
    a fool, rather than opening your mouth and proving it? Do you think the
    OP would have started this discussion if "just use a better
    microcontroller" were a viable option?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to David Brown on Sun Apr 30 02:37:03 2023
    On Saturday, April 29, 2023 at 12:01:52 PM UTC-4, David Brown wrote:
    On 29/04/2023 01:41, Rick C wrote:
    On Friday, April 28, 2023 at 8:51:33 AM UTC-4, David Brown wrote:
    On 28/04/2023 02:45, Rick C wrote:
    On Thursday, April 27, 2023 at 1:19:01 PM UTC-4, Tauno Voipio
    wrote:

    In 2016, I made a processor unit using AT91SAM4E for IEC H1
    Manchester coded bus at 31.25 kbit/s. The trick was to
    innovatively use the timer counter units of the chip. A timer
    used to measure the times between pulse edges could be used to
    receive and decode the incoming data, and a timer running at
    half of the bit rate (15.625 kbit/s) could be used to send the
    data. The receiver needed to respond to interrupts at the
    incoming edge rate, and the transmitter needed to respond at
    the outgoing bit rate.

    That's if the entire job is handled in software, perhaps. The
    USART can be used to send the bits as characters at the
    transmitter. A USART can be used to handle the reception with
    software seeking edges. I don't think that would be a huge burden
    at 38.4 kbps. But then, I'm more used to FPGA work.

    You certainly /can/ do this kind of thing in software on a Tiny.
    However, it might be a challenge depending on other factors. If
    the device already has high-precision timing requirements for
    another task, doing two of them can get complicated. If you need to
    deal with a lot of noise on the lines, that too is messy.


    I don't think you understand the issues. If there is a lot of noise,
    the project is dead in the water regardless. Fix your noise
    problems.

    This does not impose "high-precision timing requirements" on the CPU.
    The only requirements are to handle the data without dropping. It's
    NOT bit banging, so there is lots of time to handle the data.

    If the CPU is overloaded, then you picked the wrong CPU. Get a
    faster one.

    Why are you bringing in all this silliness? It's almost as if you've
    never done design work.

    Have you heard the saying that it is better to keep quite and be thought
    a fool, rather than opening your mouth and proving it? Do you think the
    OP would have started this discussion if "just use a better
    microcontroller" were a viable option?

    David, that wasn't a reply to the OP, that was to your silly speculation.

    --

    Rick C.

    ++- Get 1,000 miles of free Supercharging
    ++- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to pozz on Wed May 3 09:40:42 2023
    On Wednesday, May 3, 2023 at 12:16:49 PM UTC-4, pozz wrote:
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to the internal oscillator of ATtiny4313 that hasn't a good accuracy over temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the range 0-80°C.
    I want to thank all the ones that spent some time to reply and give suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that
    are working now.

    However a few customers reported a problem in a few installations: the
    tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise generated is capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without success. We tried to strenghten the GND connection between the resonator/quartz and the single GND pin of the SOIC20, without success.

    The only change that seems effective in avoiding blocks is using the internal oscillator.

    This is the story.

    So I assume there is a reason why you can't route the power wires away from the ATtiny board?

    I think you have been provided with all the possibilities for how to use the internal oscillator. It rather comes down to "pick one". Are any more appealing than the others? If you tell us what you don't like about it, maybe we can help refine the
    solution?

    --

    Rick C.

    +++ Get 1,000 miles of free Supercharging
    +++ Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Wed May 3 18:16:43 2023
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the range 0-80°C.

    I want to thank all the ones that spent some time to reply and give suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that
    are working now.

    However a few customers reported a problem in a few installations: the
    tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise generated is capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without success. We tried to strenghten the GND connection between the
    resonator/quartz and the single GND pin of the SOIC20, without success.

    The only change that seems effective in avoiding blocks is using the
    internal oscillator.

    This is the story.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Thu May 4 10:34:19 2023
    Il 03/05/2023 18:40, Rick C ha scritto:
    On Wednesday, May 3, 2023 at 12:16:49 PM UTC-4, pozz wrote:
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal PLL to >>> reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over
    temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the >>> range 0-80°C.
    I want to thank all the ones that spent some time to reply and give
    suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that
    are working now.

    However a few customers reported a problem in a few installations: the
    tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise generated is
    capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without
    success. We tried to strenghten the GND connection between the
    resonator/quartz and the single GND pin of the SOIC20, without success.

    The only change that seems effective in avoiding blocks is using the
    internal oscillator.

    This is the story.

    So I assume there is a reason why you can't route the power wires away from the ATtiny board?

    It depends. In some cases it is possible, in other cases it isn't. The installer isn't usually competent, so it routes cables as he wants. In
    some cases, too near my board. After some weeks or months, he complains
    the board has blocked. And he is my customer...


    I think you have been provided with all the possibilities for how to use the internal oscillator. It rather comes down to "pick one". Are any more appealing than the others? If you tell us what you don't like about it, maybe we can help refine the
    solution?

    At the moment we are deciding what could be the best solution.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to pozz on Thu May 4 12:31:57 2023
    On 04/05/2023 10:34, pozz wrote:
    Il 03/05/2023 18:40, Rick C ha scritto:
    On Wednesday, May 3, 2023 at 12:16:49 PM UTC-4, pozz wrote:
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the >>>> SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will
    use an external 32.768kHz crystal (that is multiplied by internal
    PLL to
    reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to >>>> the internal oscillator of ATtiny4313 that hasn't a good accuracy over >>>> temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in
    the
    range 0-80°C.
    I want to thank all the ones that spent some time to reply and give
    suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that
    are working now.

    However a few customers reported a problem in a few installations: the
    tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise generated is >>> capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without
    success. We tried to strenghten the GND connection between the
    resonator/quartz and the single GND pin of the SOIC20, without success.

    The only change that seems effective in avoiding blocks is using the
    internal oscillator.

    This is the story.

    So I assume there is a reason why you can't route the power wires away
    from the ATtiny board?

    It depends. In some cases it is possible, in other cases it isn't. The installer isn't usually competent, so it routes cables as he wants. In
    some cases, too near my board. After some weeks or months, he complains
    the board has blocked. And he is my customer...


    I think you have been provided with all the possibilities for how to
    use the internal oscillator.  It rather comes down to "pick one".  Are
    any more appealing than the others?  If you tell us what you don't
    like about it, maybe we can help refine the solution?

    At the moment we are deciding what could be the best solution.



    Do you do EMC testing for radiation emission and susceptibility? I
    don't know what the rules and regulations are like where you are, but
    any finished product (as distinct from prototype or test systems) made
    here in Europe should be EMC certified. If radiated noise from "normal"
    power cables killed a card, that would be a failure in the certification.

    Or is it the surrounding system that is bad? Maybe there is something
    truly terrible connected to these power cables?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to pozz on Thu May 4 06:21:14 2023
    On Thursday, May 4, 2023 at 4:34:25 AM UTC-4, pozz wrote:
    Il 03/05/2023 18:40, Rick C ha scritto:
    On Wednesday, May 3, 2023 at 12:16:49 PM UTC-4, pozz wrote:
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the >>> SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will >>> use an external 32.768kHz crystal (that is multiplied by internal PLL to >>> reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to >>> the internal oscillator of ATtiny4313 that hasn't a good accuracy over >>> temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the >>> range 0-80°C.
    I want to thank all the ones that spent some time to reply and give
    suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that >> are working now.

    However a few customers reported a problem in a few installations: the
    tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise generated is >> capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without >> success. We tried to strenghten the GND connection between the
    resonator/quartz and the single GND pin of the SOIC20, without success. >>
    The only change that seems effective in avoiding blocks is using the
    internal oscillator.

    This is the story.

    So I assume there is a reason why you can't route the power wires away from the ATtiny board?
    It depends. In some cases it is possible, in other cases it isn't. The installer isn't usually competent, so it routes cables as he wants. In
    some cases, too near my board. After some weeks or months, he complains
    the board has blocked. And he is my customer...
    I think you have been provided with all the possibilities for how to use the internal oscillator. It rather comes down to "pick one". Are any more appealing than the others? If you tell us what you don't like about it, maybe we can help refine the
    solution?
    At the moment we are deciding what could be the best solution.

    Perhaps you can add an enclosure to your board so cables can not be so near? You could make it look like an EMI shield. Heck, a simple piece of plexiglass mounted a half inch from your board should do the job. Also, it is perfectly acceptable to
    specify that nothing be within some distance of your board. That is not an unusual thing for sensitive circuits.

    BTW, do you get the same sort of hang condition if you bring other metal near the oscillators? It may not be an EMI issue at all, but rather a capacitive effect on the oscillator circuit. They often are sensitive to the details of the parasitic values.
    If you have a resistor in series with the crystal, this might need to be reduced in value, or increased. What circuit does the manufacturer recommend for the oscillator?

    Can you provide more detail on the nature of the hang? Does the oscillator stop working? Does the frequency shift? Can you measure any of this? Just saying "without success" isn't much to go on.

    --

    Rick C.

    ---- Get 1,000 miles of free Supercharging
    ---- Tesla referral code - https://ts.la/richard11209

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Fri May 5 10:51:52 2023
    Il 04/05/2023 12:31, David Brown ha scritto:
    On 04/05/2023 10:34, pozz wrote:
    Il 03/05/2023 18:40, Rick C ha scritto:
    On Wednesday, May 3, 2023 at 12:16:49 PM UTC-4, pozz wrote:
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by
    the
    SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will >>>>> use an external 32.768kHz crystal (that is multiplied by internal
    PLL to
    reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are
    related to
    the internal oscillator of ATtiny4313 that hasn't a good accuracy over >>>>> temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be
    in the
    range 0-80°C.
    I want to thank all the ones that spent some time to reply and give
    suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that >>>> are working now.

    However a few customers reported a problem in a few installations: the >>>> tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise
    generated is
    capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without >>>> success. We tried to strenghten the GND connection between the
    resonator/quartz and the single GND pin of the SOIC20, without success. >>>>
    The only change that seems effective in avoiding blocks is using the
    internal oscillator.

    This is the story.

    So I assume there is a reason why you can't route the power wires
    away from the ATtiny board?

    It depends. In some cases it is possible, in other cases it isn't. The
    installer isn't usually competent, so it routes cables as he wants. In
    some cases, too near my board. After some weeks or months, he
    complains the board has blocked. And he is my customer...


    I think you have been provided with all the possibilities for how to
    use the internal oscillator.  It rather comes down to "pick one".
    Are any more appealing than the others?  If you tell us what you
    don't like about it, maybe we can help refine the solution?

    At the moment we are deciding what could be the best solution.


    Do you do EMC testing for radiation emission and susceptibility?  I
    don't know what the rules and regulations are like where you are, but
    any finished product (as distinct from prototype or test systems) made
    here in Europe should be EMC certified.  If radiated noise from "normal" power cables killed a card, that would be a failure in the certification.

    Yes, of course. This problem happens only on the field in a few
    installations where cables are routed near my product, that is small and
    in a plastic enclosure.


    Or is it the surrounding system that is bad?  Maybe there is something
    truly terrible connected to these power cables?


    The critical installations often have cables that gives mains power
    (230Vac) to coils, for example relays or door ring bell.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Fri May 5 11:02:25 2023
    Il 04/05/2023 15:21, Rick C ha scritto:
    On Thursday, May 4, 2023 at 4:34:25 AM UTC-4, pozz wrote:
    Il 03/05/2023 18:40, Rick C ha scritto:
    On Wednesday, May 3, 2023 at 12:16:49 PM UTC-4, pozz wrote:
    Il 26/04/2023 16:56, pozz ha scritto:
    I'd like to use async UART to let these MCUs communicate.
    The protocol will be request-response with the request generated by the >>>>> SAM MCU. The baudrate will be 38400bps.

    I'd like to use internal oscillator of ATtiny4313, while the SAM will >>>>> use an external 32.768kHz crystal (that is multiplied by internal PLL to >>>>> reach 48MHz).

    I'm not sure if this scenario can work well. My concerns are related to >>>>> the internal oscillator of ATtiny4313 that hasn't a good accuracy over >>>>> temperature and life.

    The tiny MCU will be supplied by 3.3V and its temperature will be in the >>>>> range 0-80°C.
    I want to thank all the ones that spent some time to reply and give
    suggestions. As usual, they are valuable for me.

    I'm working on a board that is already in production. It was chosen a
    tiny for its low cost.
    The possibility to mount and use an external ceramic resonator is
    available. Moreover it has been really mounted on around 1k boards that >>>> are working now.

    However a few customers reported a problem in a few installations: the >>>> tiny blocks and only a power cycle is able to restart.

    After some tests, we found that the problem is radiated noise on the
    pins of the tiny oscillator. When power cables are near the board and
    some specific load are connected to these cables, the noise generated is >>>> capable to block the tiny.

    We tried to replace the ceramic resonator with a quartz crystal without >>>> success. We tried to strenghten the GND connection between the
    resonator/quartz and the single GND pin of the SOIC20, without success. >>>>
    The only change that seems effective in avoiding blocks is using the
    internal oscillator.

    This is the story.

    So I assume there is a reason why you can't route the power wires away from the ATtiny board?
    It depends. In some cases it is possible, in other cases it isn't. The
    installer isn't usually competent, so it routes cables as he wants. In
    some cases, too near my board. After some weeks or months, he complains
    the board has blocked. And he is my customer...
    I think you have been provided with all the possibilities for how to use the internal oscillator. It rather comes down to "pick one". Are any more appealing than the others? If you tell us what you don't like about it, maybe we can help refine the
    solution?
    At the moment we are deciding what could be the best solution.

    Perhaps you can add an enclosure to your board so cables can not be so near? You could make it look like an EMI shield. Heck, a simple piece of plexiglass mounted a half inch from your board should do the job. Also, it is perfectly acceptable to
    specify that nothing be within some distance of your board. That is not an unusual thing for sensitive circuits.

    Yes, we are thinking about this solutions too.


    BTW, do you get the same sort of hang condition if you bring other metal near the oscillators? It may not be an EMI issue at all, but rather a capacitive effect on the oscillator circuit. They often are sensitive to the details of the parasitic
    values. If you have a resistor in series with the crystal, this might need to be reduced in value, or increased.

    No problem with capacitive loads.


    What circuit does the manufacturer recommend for the oscillator?

    Ceramic resonator has three pins, two that goes to the oscillator pins
    of the MCU and one is GND.


    Can you provide more detail on the nature of the hang? Does the oscillator stop working? Does the frequency shift? Can you measure any of this? Just saying "without success" isn't much to go on.

    The program seems stopped. Sincerely I didn't measure the oscilator
    frequency after the noise, so I don't know if it stopped completely
    and/or it is disturbed only during the noise.

    Anyway, the total effect seems a stopped program. I noticed that in some
    cases, this noise generates strange behaviours: GPIO connected to LED
    toggle without a reason and so on.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to pozz on Fri May 5 12:59:47 2023
    On 05/05/2023 10:51, pozz wrote:
    Il 04/05/2023 12:31, David Brown ha scritto:


    Do you do EMC testing for radiation emission and susceptibility?  I
    don't know what the rules and regulations are like where you are, but
    any finished product (as distinct from prototype or test systems) made
    here in Europe should be EMC certified.  If radiated noise from
    "normal" power cables killed a card, that would be a failure in the
    certification.

    Yes, of course. This problem happens only on the field in a few
    installations where cables are routed near my product, that is small and
    in a plastic enclosure.


    Or is it the surrounding system that is bad?  Maybe there is something
    truly terrible connected to these power cables?


    The critical installations often have cables that gives mains power
    (230Vac) to coils, for example relays or door ring bell.

    The current used for door bells - even modern monstrosities with cameras
    - is tiny. I really think something must be wrong with the card if it
    is susceptible to interference from such cables. Oscillators - crystal
    or ceramic - usually need load capacitors and a damping resistor. These
    are small loads (perhaps 15-20 pF and 10 MΩ), and are sometimes built
    into the microcontroller. But if these are missing, your oscillator
    could be unstable and easily affected by outside influence.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pozz@21:1/5 to All on Fri May 5 18:01:41 2023
    Il 05/05/2023 12:59, David Brown ha scritto:
    [...]
    The critical installations often have cables that gives mains power
    (230Vac) to coils, for example relays or door ring bell.

    The current used for door bells - even modern monstrosities with cameras
    - is tiny.

    In my installations they don't use that kind of door bells that are
    digital circuits with digital audio output. I don't know what's their
    exact name, similar to high power buzzers.


    I really think something must be wrong with the card if it
    is susceptible to interference from such cables.  Oscillators - crystal
    or ceramic - usually need load capacitors and a damping resistor.  These
    are small loads (perhaps 15-20 pF and 10 MΩ), and are sometimes built
    into the microcontroller.  But if these are missing, your oscillator
    could be unstable and easily affected by outside influence.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dimiter_Popoff@21:1/5 to pozz on Fri May 5 19:52:00 2023
    On 5/5/2023 19:01, pozz wrote:
    Il 05/05/2023 12:59, David Brown ha scritto:
    [...]
    The critical installations often have cables that gives mains power
    (230Vac) to coils, for example relays or door ring bell.

    The current used for door bells - even modern monstrosities with
    cameras - is tiny.

    In my installations they don't use that kind of door bells that are
    digital circuits with digital audio output. I don't know what's their
    exact name, similar to high power buzzers.

    If it is some solenoid driven thing with a mechanical switch it may
    cause all sorts of interference, depending also on luck - coincidence
    between button being released, solenoid switch, sine wave peak etc.
    Try to determine whether the interference which gets you is inductive
    or capacitive, or if your board is powered off the same lines.
    Things like that can be tricky to fix, you need to understand the nature
    of what gets you first.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rick C@21:1/5 to pozz on Fri May 5 11:37:26 2023
    On Friday, May 5, 2023 at 12:03:04 PM UTC-4, pozz wrote:
    Il 05/05/2023 12:59, David Brown ha scritto:
    [...]
    The critical installations often have cables that gives mains power
    (230Vac) to coils, for example relays or door ring bell.

    The current used for door bells - even modern monstrosities with cameras
    - is tiny.
    In my installations they don't use that kind of door bells that are
    digital circuits with digital audio output. I don't know what's their
    exact name, similar to high power buzzers.
    I really think something must be wrong with the card if it
    is susceptible to interference from such cables. Oscillators - crystal
    or ceramic - usually need load capacitors and a damping resistor. These are small loads (perhaps 15-20 pF and 10 MΩ), and are sometimes built into the microcontroller. But if these are missing, your oscillator
    could be unstable and easily affected by outside influence.

    You are talking about exactly like a buzzer, but with a clapper for the bell. A mechanical switch interrupts the current to the coil and very likely arcs on opening and closing, generating significant EMI. Perhaps you could convince them to add a
    capacitor like they used in automotive spark systems? The spark should be in the right place.

    --

    Rick C.

    ---+ Get 1,000 miles of free Supercharging

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grant Edwards@21:1/5 to pozz on Fri May 5 20:16:03 2023
    On 2023-05-05, pozz <pozzugno@gmail.com> wrote:

    The critical installations often have cables that gives mains power
    (230Vac) to coils, for example relays or door ring bell.

    People use 230VAC for _doorbells_?!?! Are they trying to wake the dead?

    Here in the US doorbells are usually 16VAC, though 24VAC is also used.
    I've also seen 10VAC and 12VAC mentioned, but I think that's uncommon.

    --
    Grant

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)