EmbeddedRelated.com
Forums

UART connection between ATSAMD20 and ATtiny4313

Started by pozz April 26, 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.
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.
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.
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.
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
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
Il 05/05/2023 22:16, Grant Edwards ha scritto:
> 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.
They are very common here (for example [1]). 230Vac is the common mains voltage so the doorbells are connected to mains, through a momentary switch out of the door. [1] https://comenzielectrice.ro/pdf/Bticino%20-%20Matix%20Catalog.pdf Search for AM5048
Il 05/05/2023 18:52, Dimiter_Popoff ha scritto:
> 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,
I saw it... very well.
> you need to understand the nature of what gets you first.
I will try. It's much more simple to avoid the problem at all disabling internal oscillator.
Il 05/05/2023 20:37, Rick C ha scritto:
> On Friday, May 5, 2023 at 12:03:04&#8239;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&Omega;), 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. >
Ok, thanks for suggestion.
On Sunday, May 7, 2023 at 5:17:55&#8239;PM UTC-4, pozz wrote:
> Il 05/05/2023 22:16, Grant Edwards ha scritto: > > On 2023-05-05, pozz <pozz...@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. > They are very common here (for example [1]). 230Vac is the common mains > voltage so the doorbells are connected to mains, through a momentary > switch out of the door. > > [1] https://comenzielectrice.ro/pdf/Bticino%20-%20Matix%20Catalog.pdf > Search for AM5048
I don't know about where you live, but doorbells in the US are powered from low voltage, so they don't require all the safety precautions. A device on a high voltage circuit has to be mounted on a box or has to be a box rated for such wiring. A door bell uses much simpler wiring and needs no special boxes or precautions. I have seen no small number of doorbell buttons mounted directly in the door frame, having been drilled out to 1/2 inch for mounting the button. -- Rick C. --+- Get 1,000 miles of free Supercharging --+- Tesla referral code - https://ts.la/richard11209