I am using Portenta H7 with LoRa Vision Shield for a field application where I’ll be powering the system up with 5V on VIN and using camera and LoRa. I also have a few external modules connected to pins that I have chosen to ensure they don’t conflict with camera or LoRa:
PIR - PA8
RTC - D11/12 (I2C)
PWM driver - PH15
Switch - PC7
LEDs - PG7,
In my trials I’ve come across Sensor control failed issues a lot so was hoping to engage in some discussion here to understand why this happens so often (as reported by other users too).
During my runs:
-
The first time I power the system up, it fails quite often (Sensor control failed: got it in log files through try-catch). If I disconnect the battery and connect, it works most of the times. Sometimes, I have to take the Portenta out of the PCB and re-insert, OR disconnect the camera (HM01B0/HM0360) and reconnect, OR disconnect the whole Vision Shield and reconnect. I have not been able to find a standard solution yet.
-
Once the Portenta does not work in my PCB, I often take it out of the board and connect to my PC to understand what’s happening. I see the IDE detect the sensor but still throw the same error. Often the same fixes as described in point 1 fixes the issue.
- I also suspect that sometimes getting a
HIGH on PIR while the system is prepping Camera and LoRaWAN connection fails the application. I don’t have evidence on this yet as it’s just observation based, and I haven’t looked into this too much yet but thought this could be useful info. I will raise a separate query for this soon.
If you could help me understand methods, software or hardware, that I could use to eliminate the issue, it would be of great help. The system is to be used by field scientists with zero debugging knowledge so success of application is dependent on its user friendliness.
PC
Hi Prithulc, do you have a script which can generate the issue on the standard portena board and the lora shield in a standalone situation? I don’t have a lora network to connect to. So, it’s hard for me to help beyond testing the default system.
Hi Kwabena, let me check if I can make a simple script to reproduce the issue. Sorry, this might take a while as I’ll also check if I’m getting the issue without PCB board (as in, on a breadboard with 5V input on VIN). Get back to you soon.
PC
Sorry for the delay!
I finally narrowed down the potential causes of the issue mentioned: I am using this 5V RTC (I2C based- Adafruit DS1307 Real Time Clock Assembled Breakout Board : ID 3296 : Adafruit Industries, Unique & fun DIY electronics and kits) with my Portenta+VisionShield (LoRa) that seems to be the culprit. I have also tested this with this 3V RTC (I2C based again- PiicoDev Real Time Clock (RTC) RV-3028 | Buy in Australia | CE08239 | Core Electronics) so I suspected it’s not a specific RTC issue. The connections are:
RTC - Portenta
VIN - 5V+ (3V+ for a 3V RTC)
Gnd - Gnd
SDA - D11
SCL - D12
Here’s a simple program that helps me reproduce the problem (not RTC specific). Expected outcome is red onboard LED blinks:
import sensor, pyb
sensor.reset()
sensor.set_auto_exposure(1)
sensor.set_auto_rotation(1)
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 1000)
r_led = pyb.LED(1)
while True:
img = sensor.snapshot()
r_led.on()
pyb.delay(1000)
r_led.off()
pyb.delay(1000)
The best steps to reproduce the issue for me has been:
- Save the above
main.py program onto the Portenta+VisionShield
- Disconnect Portenta from USB-C
- Make connections as specified above with the RTC module
- Connect Portenta to USB-C
I have noticed how if I connect the USB-C first and then the RTC, the system works as expected (including RTC specific code that fetches datetime). Once you get it working, if you want to reproduce the issue again, disconnect the live and ground connections and connect again before powering the Portenta up.
I wanted to check if I can reproduce the issue without RTC also (to basically see if this can occur with any I2C module) but I don’t have anything else compatible. The 5V RTC I have gives SDA/SCL out voltage of 5V (3V for 3V RTC module) but I’m scared to give 5V from a bench supply to pins D11/D12 and accidentally brick the Portenta.
Regards,
PC
Hi, the issue here is that I2C bus shared with the camera sensor. So, it finds your RTC device and it’s not an expected camera sensor so our firmware stops and errors out since it doesn’t know what to do given that it appears on the I2C bus. After the system boots the scan has finished and it won’t do it again until reboot.
To fix this, you need to use a different I2C bus. However, the Portenta only exposes one hardware bus on it’s 0.1" pins. Instead use Machine.SoftI2C which can be a bus master and use any two other free I/O pins.
Thanks for the guidance, Kwabena! SoftI2C on D10/9 solved it. Don’t have a lot of spare pins left LOL
PC