XU4 Shifter-Shield random GPIO output?

Post Reply
algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Tue Nov 12, 2019 1:02 am

Hello,

I am building smart heating using Odroid XU4, Shifter Shield and 8ch relay board. The problem I have is when writing to one of the outputs, other outputs randomly changes to the same value as well. I am almost certain, that the relay board is not faulty- it worked just fine with raspberry pi.
Screenshot from 2019-11-11 17-48-44.png
Screenshot from 2019-11-11 17-48-44.png (20.64 KiB) Viewed 782 times
Red arrows in screenshot marks faulty GPIO state changes (blue color channels with wrong output). Green color is gpio state is 0 (on), red color - gpio state is 1 (off). As you can see in screenshot, the problem is occuring not everytime and not with the same outputs. Sometimes two additional outputs changes values, sometimes all of the outputs changes value. And this behaviour occurs only when turning on relays (settings gpio to 0, as relays has inverted logic).

I've additionally connected 7 DS18B20 temperature sensors as follows:
PIN 2 - 5V to DS18B20 VCC
PIN 20 - GND to DS18B20 GND
PIN 22 - IO. 24 to DS18B20 SIGNAL
PIN 17 - 3.3V to DS18B20 SIGNAL via 10k ohm resistor
Sensors works fine, but maybe they could be the culprit of the problem?

Also, if it would help, I'm using these physical GPIO pins as outputs to relay board:
PIN 3 - I2C1.DA (GPIO_08)
PIN 5 - I2C1.CL (GPIO_09)
PIN 7 - IO. 18 (GPIO_07)
PIN 8 - UART.TX (GPIO_15)
PIN 10 - UART.RX (GPIO_16)
PIN 12 - IO. 173 (GPIO_01)
PIN 13 - IO. 21 (GPIO_03)
PIN 16 - IO. 19 (GPIO_04)

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Tue Nov 12, 2019 1:25 am

To replicate problem, all I have to do is to change states few times:
Screenshot from 2019-11-11 18-20-18.png
Screenshot from 2019-11-11 18-20-18.png (160.56 KiB) Viewed 778 times

User avatar
odroid
Site Admin
Posts: 32677
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 209 times
Been thanked: 364 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by odroid » Tue Nov 12, 2019 11:13 am

I think you have to disable I2C and UART function by editing DeviceTree files to use those pin in pure GPIO modes.
I will double check with my colleagues.

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Tue Nov 12, 2019 4:21 pm

I've done some testing - disconnecting DS18B20 sensors seem to help and problem could not be longer replicated. I guess there is something going on when sensors data being read and GPIO state is changing. I tried to change relay state every second and it looks like voltage drop happening (that would be strange, because power supply driving Odroid with Shifter Shield and relay board is 5V 6.5A) - when relay goes off, indicator led of the relay also goes off, but when relay goes on, indicator led goes on, but very dimmed and strange sound could be heard. Anyways, as I said, disconnecting DS18B20 sensors solves the problem, but it would be perfect if I could have senors and relays on one device.

User avatar
odroid
Site Admin
Posts: 32677
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 209 times
Been thanked: 364 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by odroid » Tue Nov 12, 2019 5:39 pm

It is very worth to measure the voltage on 5V rail of the 30pin header with a DMM when relays turn on.

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Tue Nov 12, 2019 6:41 pm

https://wiki.odroid.com/accessory/add-o ... ift_shield

Maybe, isn't it the maximum current problem?

I'm not sure :(, because I don't know your circuit,

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Tue Nov 12, 2019 9:19 pm

I've read this article:
https://wiki.odroid.com/odroid-xu4/appl ... gpio/1wire
"XU4 Shifter-Shield was not working well with multiple 1-wire devices due to a timing/weak-driving issue."

Maybe this was the case? Since i've disconnected 1-wire sensors - relay board working without issues.
My connecting scheme was like this:
Screenshot from 2019-11-12 14-18-23.png
Screenshot from 2019-11-12 14-18-23.png (18.1 KiB) Viewed 684 times

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Wed Nov 13, 2019 7:14 am

Well, apparently problem still persists. Should i try using non I2C / UART GPIO pins?

User avatar
odroid
Site Admin
Posts: 32677
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 209 times
Been thanked: 364 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by odroid » Wed Nov 13, 2019 8:49 am

Please try other generic GPIO pins and keep checking the system voltage(5V) to narrow down root causes.

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Wed Nov 13, 2019 9:31 am

If you used the shield for 1.8v to 3.3v, can you try again after changing to 5v?

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Thu Nov 14, 2019 5:37 am

Since I've disconnected one wire sensors, replicate problems became much harder, but still possible. Bad news - changin GPIO ports did not help. What I've noticed, that problem most likely to occur when gas boiler starts heating domestic water. Gas boiler thermostat relay is connected to channel 1 relay (but it stays off, as it should). I don't know what, but maybe something might change in voltage? I've measured VCC 5V - it stays stable at ~5.04V - 5.05V at all times. For testing purposes, I've connected relay board to Shifter Shield's 5V line (not to power supply directly). I am unable to replicate problem so far. By the way, I've found schematics and descriptions of my used relay board. Maybe you could evaluate and see potential problems using it with Odroid?
Board: https://www.waveshare.com/rpi-relay-board-b.htm
Wiki: https://www.waveshare.com/wiki/RPi_Relay_Board_(B)
Schematics: https://www.waveshare.com/wiki/File:RPi ... ematic.pdf

If this helps - I'am not using Header 20x2 (connector P3 / P6), because pin layout differs from Rasberry PI and Odroid Shifter Shield. I've disconnected switches from Header 8x2 (P10) and connected approriate GPIO's of Shifter Shield to this header. Also, I am no longer powering relay board P9 contacts to power supply, because I've provided 5V from shifter shield to connector P3 / P6 pins 4 (+5v) and 6 (gnd)

User avatar
odroid
Site Admin
Posts: 32677
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 209 times
Been thanked: 364 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by odroid » Thu Nov 14, 2019 9:39 am

We will order one soon to test the relay board.

BTW, did you connect the XU4+ShifterShield to the relay board directly? or via flat IDC cable?

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Thu Nov 14, 2019 3:58 pm

At first I've connected directly to board, but GPIO pins differs (especially PIN 35 to PIN 40) from raspberry pi and Odrdoid could not boot at all or control relays.
Then I used dupont wires to connect appropriate GPIOs to relay board header P10.

User avatar
odroid
Site Admin
Posts: 32677
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 209 times
Been thanked: 364 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by odroid » Thu Nov 14, 2019 4:14 pm

I see.
Once we receive the relay board, we will try to reproduce the issue.
But delivery might take a week at least from China to Korea.

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Thu Nov 14, 2019 4:16 pm

That ok, I can wait :) Also, connecting relay board from odroids 5v line improved situation so far.

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Wed Nov 20, 2019 4:07 pm

@algirdasc

Did you disable I2C and UART in dtb?

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Wed Nov 20, 2019 4:18 pm

No I did not, all I did was connect relays to non-I2C or non-UART GPIO ports and powered relay board from Shifter Shields 5V / GND, not from power supply directly. So far - problem is gone. Also, I'm thinking about connecting back 1-wire sensors, and see if this issue reappears.

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Wed Nov 20, 2019 4:35 pm

When you used power supply, did you connect xu4 GND to power supply GND?

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Wed Nov 20, 2019 4:49 pm

Yes, well at least it looks like so. I'm using Mean Well 5V 6.5A power supply, and it has two terminals for each +V and -V. To one of them I've connected relay board, to other ones - Odroid via barel plug. By the way, If it makes difference - long time ago I've had to remove / bypass TPS259251 chip, as I burned it with reversed polarities.
DR-30-5-3-600x600.jpg
DR-30-5-3-600x600.jpg (40.12 KiB) Viewed 424 times

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Wed Nov 20, 2019 5:06 pm

connect(1).jpg
connect(1).jpg (103.19 KiB) Viewed 406 times
For testing, I connected xu4 to relay board as shown above.

When shift-shield used 3.3v regulator and connected multimeter GND to xu4 GND, some relay temporarily turned on. But it was not when using 5v.
I'm not sure whether these factors affect.

Once I find the DS18B20 and power supply, I will try to duplicate the situation.

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Wed Nov 20, 2019 5:31 pm

I'm not sure If I understood correctly - Did you connect relay board to power supply directly? I'm talking about purple and white/gray wire going to breaboard. This is the way I've connected when I could replicate problem. Now I connected 5v and GND from XU to 20x2 pin header. As I understand correctly by connecting directly to pin header I've bypassed relay boards' level shifter (i don't know correct term).
Untitled.jpg
Untitled.jpg (109.1 KiB) Viewed 401 times

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Wed Nov 20, 2019 5:51 pm

connection on your photo and my connection are the same.
Weird thing is that when I gave external disturbances to relay's COM, some relay temporarily turned on.
It seems that relay isolation has a problem or level shifter can't drive enough.

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Wed Nov 20, 2019 7:20 pm

Isn't in my way bypassing level shifter? I mean this A7-A8 parts in https://www.waveshare.com/w/upload/d/db ... ematic.pdf?

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Fri Nov 22, 2019 10:37 am

relay.png
relay.png (25.67 KiB) Viewed 327 times
level.png
level.png (30.26 KiB) Viewed 327 times


Because of connection from BPORTx of shield to IN_CHx of the relay, TXS0108E(level shifter) affects the circuit.

algirdasc
Posts: 15
Joined: Fri Sep 21, 2018 5:49 am
languages_spoken: english, russian, lithuanian
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by algirdasc » Fri Nov 22, 2019 4:30 pm

Could you please elaborate? I'm not sure I understood correctly.

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Mon Nov 25, 2019 11:39 am

I don't know what you didn't understand. So I've summarized what I've investigated so far.

1. XU4 GPIO voltage level is 1.8V.
2. XU4 shield shifts voltage level 1.8V to 3.3V or 5V. But maximum current is 4mA. Recommend current is 1mA.
3. This affects sinking as well as sourcing.(I'm not sure about this.)
4. Relay board trigger signal can be 3.3V or 5V.
5. Relay board closed current is 6mA/Channel.
6. External disturbances to relay affects shift shield. It seems to be isolation problem.
7. Switching XU4 shield's voltage to 5V, The frequency of problems was decreased. But it still exists.

I'm going to do test using 2N3904 NPN switch circuit between sheld and relay.

User avatar
tony.hong
Posts: 52
Joined: Tue Jun 04, 2019 1:49 pm
languages_spoken: korean
ODROIDs: All
Location: korea
Has thanked: 11 times
Been thanked: 9 times
Contact:

Re: XU4 Shifter-Shield random GPIO output?

Unread post by tony.hong » Mon Nov 25, 2019 3:39 pm

2n3904.jpg
2n3904.jpg (161.34 KiB) Viewed 179 times
2n3904-sch.png
2n3904-sch.png (6.59 KiB) Viewed 179 times
It seems to be fine.
When turning all relay on, it consumes about 500mA.
But, XU4 was sometimes shut down because the relay coil momentarily pulled current.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 0 guests