tina870163
Posts: 7
Joined: Fri Jul 13, 2018 8:05 am

RPi Zero W received TX RX message garbled

Thu Jul 26, 2018 3:48 am

Hi,
I have use a RS485(UART) to USB to connect on my PC, I can received message from PC correctly, but when I send message from PC to RPi, RPi received message garbled.

Setup:
Raspberry Pi Zero W
2018-04-18-raspbian-stretch
Connected via USB with Xshell 6 for managment


/boot/config.txt

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
dtoverlay=pi3-disable-bt
dtoverlay=pi3-miniuart-bt

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

enable_uart=1

core_freq=250

#force_turbo=1

/boot/cmdline.txt

Code: Select all

#dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=4515e8b5-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4  elevator=deadline fsck.repair=yes   rootwait


picture of my issue
Image

I don't know what can I fix this, I follow
https://www.raspberrypi.org/documentati ... on/uart.md
and
https://openenergymonitor.org/forum-arc ... 12311.html
but still now working...

Any ideas, has anyone been through this?

Regards,
Tina

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPi Zero W received TX RX message garbled

Thu Jul 26, 2018 9:45 am

You don't need sudo to run minicom since your pi userid is in the dialout group.

Since your problem looks like a baudrate mismatch try
minicom -b 115200 -s
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

tina870163
Posts: 7
Joined: Fri Jul 13, 2018 8:05 am

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 2:55 am

Thanks for the replying, I tried but still the same.

Image

Image

Is there anything I did wrong?

Regards,
Tina

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 5:28 am

Somehow your screenshot does make sense:

Code: Select all

minicom -d 115200 -s
according to my help display this means:

Code: Select all

  -d, --dial=ENTRY       : dial ENTRY from the dialing directory
  -s, --setup            : enter setup mode
The road to insanity is paved with static ip addresses

tina870163
Posts: 7
Joined: Fri Jul 13, 2018 8:05 am

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 6:20 am

Thanks for you replying, I do enter the setup mode
Image

and

Image
Image
I choice yes, last time I choice no, and I can communication with my pc but all I get from pc is garbled message
Image

should I setting anything here?

Regards,
Tina

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 7:32 am

You should read what DougieLawson wrote:
DougieLawson wrote:minicom -b 115200 -s
The important option is "-b" to set the speed, the "-s" gives some more options which might not need.

My advice: for testing drop the speed to 1200 and try again with the following command on the Pi:

Code: Select all

minicom -b 1200
do not forget to change the speed on your PC.

If you are still having problems after dropping the speed then I suggest you disconnect the RX and TX signal wire at the screw terminals. On the cable connect RX to TX, do the same on the screw terminal. (WARNING: Do not connect TX or RX to GND). Now set the speed to 1200 on each device and type something in the terminal program, every character you type should be echoed giving feedback on the operation of the serial interface.

If this works but it does not work with you adapter then (BEFORE RECONNECTING) find the documentation on each part and check the operating voltages. When I look at your photo I get the impression that the part with the screw terminals does not have any active components, which means the the Pi is directly connected to the USB adapter which I find highly suspicious looking like and ordinary (not 3.3V) RS232 USB interface. If this is correct then you may have found your problem.

The simplest way to connect a Pi to a PC with a serial connection is to use one of these cables: https://shop.pimoroni.com/products/usb- ... sole-cable
The road to insanity is paved with static ip addresses

User avatar
bensimmo
Posts: 4654
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 7:51 am

Probably not your solution, but there are a few mixed up overlays there.


dtoverlay=pi3-disable-bt
this disables Bluetooth and sets gpioUART to ttyAMA0
did you also run sudo systemctl disable hciuart

dtoverlay=pi3-miniuart-bt
this is not needed, this is to switch BT and gpioUART around

enable_uart=1
this turns on gpioUART (good)

core_freq=250
this should not be done, since you have switched uarts around (it was used to stabilise UART on the mini UART, ttyS0.
Last edited by bensimmo on Fri Jul 27, 2018 8:05 am, edited 1 time in total.

User avatar
bensimmo
Posts: 4654
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 7:56 am

I'm not sure what else you are altering in cmdline.txt but that is a lot of changes.
For UART, the only change you need iirc is to remove the reference to console=/dev/serial0 line.


Did you try first without disabling Bluetooth and use the normal setup and using rapsi config to enable the serial port?

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 8:21 am

tina870163 wrote:
Thu Jul 26, 2018 3:48 am
Hi,
I have use a RS485(UART) to USB to connect on my PC, I can received message from PC correctly, but when I send message from PC to RPi, RPi received message garbled.

Why RS485 to connect to the Raspberry Pi UART ?

https://www.raspberrypi.org/documentati ... on/uart.md
https://www.electronicdesign.com/what-s ... interfaces
The road to insanity is paved with static ip addresses

drgeoff
Posts: 10832
Joined: Wed Jan 25, 2012 6:39 pm

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 9:04 am

Ernst wrote:
Fri Jul 27, 2018 7:32 am
When I look at your photo I get the impression that the part with the screw terminals does not have any active components, which means the the Pi is directly connected to the USB adapter which I find highly suspicious looking like and ordinary (not 3.3V) RS232 USB interface. If this is correct then you may have found your problem.
+1
Quis custodiet ipsos custodes?

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 10:57 am

drgeoff wrote:
Fri Jul 27, 2018 9:04 am
Ernst wrote:
Fri Jul 27, 2018 7:32 am
When I look at your photo I get the impression that the part with the screw terminals does not have any active components, which means the the Pi is directly connected to the USB adapter which I find highly suspicious looking like and ordinary (not 3.3V) RS232 USB interface. If this is correct then you may have found your problem.
+1
I would agree, except the OP reports he can receive data correctly from the PC to the Pi. That shouldn't work either with Pi UART and PC RS232 polarities being inverted.

But the OP does say he's using RS485 rather than RS232 and I believe both polarities can be present, so that may be why PC to Pi works.

Perhaps the Pi to PC connection has some inversion when it shouldn't, or vice-versa ?

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 11:37 am

hippy wrote:
Fri Jul 27, 2018 10:57 am
I would agree, except the OP reports he can receive data correctly from the PC to the Pi
:?: Am I missing something here :?:
Looking at the screenshots PC to Pi does *not* work

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 12:20 pm

DirkS wrote:
Fri Jul 27, 2018 11:37 am
hippy wrote:
Fri Jul 27, 2018 10:57 am
I would agree, except the OP reports he can receive data correctly from the PC to the Pi
:?: Am I missing something here :?:
Looking at the screenshots PC to Pi does *not* work
You may be right. Re-reading the OP's post shows it doesn't make a lot of sense, is contradictory, and I may have misinterpreted that - "I can received message from PC correctly, but when I send message from PC to RPi, RPi received message garbled".

Whatever it's saying I would take that as 'works one way, but not the other'. Maybe that's not correct.

tina870163
Posts: 7
Joined: Fri Jul 13, 2018 8:05 am

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 9:12 pm

Ernst:
Thank you for your replying, I will try your advice and come back soon.
What I am planning to do is using RPi to communicate a solar device via RS485, but I can't see what happened if I send command to solar device directly, so I simulate a TX RX device on my pc to communicate to RPi first, that I can see the request and the response both.
This is what the cable I use to connect to RPi :http://www.uotek.com/pro_view-119.html

bensimmo:
Thank you for your replying,
Did you try first without disabling Bluetooth and use the normal setup and using rapsi config to enable the serial port?
I did try before, I had try so many solution from google, but the message I can receive from my pc still garbled.

hippy & DirkS:
Thank you for your replying, I DO received message from RPi to PC correctly, I CAN'T received message from PC to RPi correctly,
so I don't know what's going on with my situation :cry:

Regards,
Tina

drgeoff
Posts: 10832
Joined: Wed Jan 25, 2012 6:39 pm

Re: RPi Zero W received TX RX message garbled

Fri Jul 27, 2018 9:47 pm

That "cable" is not appropriate for use between a RPi and a PC. Only its USB end should be connected to a RPi.

You need a "USB to 3.3 volt serial" interface like https://www.ebay.co.uk/itm/Chipset-FT23 ... 2574495907. USB end to the PC.
Quis custodiet ipsos custodes?

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RPi Zero W received TX RX message garbled

Sat Jul 28, 2018 6:18 am

tina870163 wrote:
Fri Jul 27, 2018 9:12 pm
What I am planning to do is using RPi to communicate a solar device via RS485, but I can't see what happened if I send command to solar device directly, so I simulate a TX RX device on my pc to communicate to RPi first, that I can see the request and the response both.
This is what the cable I use to connect to RPi :http://www.uotek.com/pro_view-119.html
I see a problem here, drgeoff has already given you feedback on the cable but that is not the problem.

Your intention is to make the Pi0 communicate with a solar device, the solar device has a RS485 interface and the Pi0[W] has one USB or 3.3v serial. You are using an USB to RS485 adapter, in the real world you would plug the USB cable into an OTG cable that goes into the Pi0 and the RS485 into the solar device. This means that it will only work if there is a driver for this device.
The road to insanity is paved with static ip addresses

hippy
Posts: 7911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: RPi Zero W received TX RX message garbled

Sat Jul 28, 2018 8:19 am

It should be possible to talk to the solar device or the PC with an RS485-to-USB interface connected but you will need some kind of interface between the Pi's UART and the RS485 bus -

Code: Select all

.----------.   .---.       .---------------------.
| Pi  UART |---|I/F|===/===| RS485  Solar Device |
`----------'   `---'       `---------------------'

.----------.   .---.       .-------.   .---------.
| Pi  UART |---|I/F|===/===| RS485 |---| USB  PC |
`----------'   `---'       `-------'   `---------'
I suspect you have the Pi's UART RX connected to RS485 A+ and Pi's UART TX connected to RS485 B- and that will not work bi-directionally.

tina870163
Posts: 7
Joined: Fri Jul 13, 2018 8:05 am

Re: RPi Zero W received TX RX message garbled

Tue Jul 31, 2018 9:38 am

Thank you for all your kindly reply :D
I add a board for ttl communication, and it work!!
Thank you guys again

Return to “Troubleshooting”