Why UART data is getting corrupted? and all the sensors are hanged?

27 views
Skip to first unread message

T Obulesu

unread,
May 3, 2019, 2:57:38 AM5/3/19
to NYCResistor:Microcontrollers



I'm getting a strange issue. We have a Atmega 128 controller board that keeps on polling 15 Atmega8 based ultrasonic sensors. They are connected in RS 422 model where all Tx pins of 15 sensors are connected together and in-turn connected to the Rx of the Atmega 128 controller and all Rx pins of 15 sensors are connected together and finally connected to the Atmega 128.. 

Am making sure that the communication protocol is implemented correctly.. I mean.. no data collision among the sensors.. enabling and disabling Tx/Rx links property while exchanging the messages....


The problem is.. when I saw the output through the UART on the Atmeg128 controller, the output looks fine.. it is keeping on polling and I saw the below polling message...

01P 02P ......15P

Meaning 01 sensor.. what is the status..., 02 sensor what's the status ..? etc.. and sensors are also properly responding..


But when I checked on the next day, either none of them are working or few of them got frozen.


When I checked the same UART data,.. I found some scrap message or sometimes no UART data at all... 

And sometimes though Atmega 128 is polling fine, Atmega 8 is not at all responding.. it is mute..

No loose contacts ... 

Why so?

There's watchdog timer running in all Atmega8 and atmega128 also..

What are the typical causes for this strange issue?

Power supply is a 12V dc , meanwhile brand...



Is it because somewhere some spikes are corrupting the code?

We used an ethernet cable to connect the devices... Out of 8 wires in the ethernet cables, we use only 6 ... for Vcc, GND, Tx+,Tx-, Rx+,Rx-.....

Anders Nelson

unread,
May 3, 2019, 8:37:34 AM5/3/19
to nycresistormi...@googlegroups.com
Tell us more about the cabling, RS422 drivers and termination resistor(s). Do you have an oscilloscope you can probe the lines with? That will tell you for certain if it's an analog issue.

After the analog signalling is confirmed good, we can look at code with you.

=]


--
You received this message because you are subscribed to the Google Groups "NYCResistor:Microcontrollers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nycresistormicrocon...@googlegroups.com.
To post to this group, send email to nycresistormi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nycresistormicrocontrollers.
For more options, visit https://groups.google.com/d/optout.

David Wong

unread,
May 3, 2019, 9:29:38 AM5/3/19
to nycresistormi...@googlegroups.com

What is the baud rate and is the click of the CPU set up so that there are no framing errors.

How do you handle errors, dropped packets etc.

Since you are multidrop, how are you doing your addressing?


Sent using the free mail.com iPhone App

Glen Duncan

unread,
May 3, 2019, 11:01:18 AM5/3/19
to nycresistormi...@googlegroups.com


On Fri, May 3, 2019 at 2:57 AM T Obulesu <obul...@gmail.com> wrote:



They are connected in RS 422 model where all Tx pins of 15 sensors are connected together and in-turn connected to the Rx of the Atmega 128 controller and all Rx pins of 15 sensors are connected together and finally connected to the Atmega 128.. ... enabling and disabling Tx/Rx links property while exchanging the messages....

Can you go over your topology in a little more detail? Which RS422 transceiver are you using? Are you using two busses for RX and TX (duplex) as depicted? For the topology shown, there should be no need for the master to disable the TX (although there's no harm in doing so), but the slaves should only enable TX when they have something to say. Make sure none of your slaves are stuck in TX.
 

nocando152

unread,
May 4, 2019, 12:18:10 AM5/4/19
to nycresistormi...@googlegroups.com
You have a thread on this running on AVRfreaks.


Some very good questions are being asked there and you havent responded.

Jim

--
Reply all
Reply to author
Forward
0 new messages