I have a raspberry CM3 running a custom Linux version created by buildroot (kernel: 4.19.44-v7). The CM3 is configured to be part of a measurement system that is used on a quad-bike (so a lot of vibrations).
I have several peripheral enabled:
- ENC28J60 for ethernet connection on SPI0 (GPIO pins 9,10,11, no CE, int_pin=25)
- Serial console on UART0 (GPIO pins 14 and 15)
- Sensor measuring at 5 hz on UART1 (GPIO pins 32 and 33)
code snippet from my config.txt:
ENC28J60 network interface: Default int_pin = 25 dtoverlay=enc28j60,int_pin=25 # Core Freq must be set to static for the miniUART core_freq=250 # Enable UART: enable_uart=1 dtoverlay=uart1,txd1_pin=32,rxd1_pin=33
Now I am experiencing a problem that when I unplug the ethernet cable my sensor that is reading from UART1 experiences an error in the communication with the sensor. What I see from the data collected:
- The command that requests data from the sensor is not sent
- The next data packet received from the sensor has additional bytes (1-5).
My conclusion from this is that there is interference on the UART communications from the interrupt caused by the ethernet disconnect event.
I have found that there can be interference betwen SPI1 and the UART1 LINK . However since I am using SPI0 I would not expect this. To make sure That Above behavior is not caused by UART1 being the inferior UART (miniuart). I have checked if something would change by switching the UARTS (putting gpio 14/15 in ALT5 and 32/33 in ALT3). Still the same issue.
At this point I am not sure how to solve this issue, or even collect more information on this issue. Some help in where to look to solve this issue would be very helpful.
Final note: I am using serialport in NodeJS to read and write to the sensor port through the UART. Since the issue happens at a disconnect event from the ethernet I do not think this part is the issue.
Edit 1: Why this is a problem is because the measurement system is used on a quad-bike. For some reason (probably vibrations) the 'unplugging' event of the ethernet cable randomly happens causing this error. This means I am losing measurements, which is the real problem I want to solve.