2025-09-29 10:08 AM - edited 2025-09-29 10:27 AM
Hi all,
I am new to STM32 programming. I have been able to write a driver for an ultrasonic distance sensor, flash the board, and measure distance, in Rust.
Now, I am trying to get a STM32F401RE to talk to a X-NUCLEO-53L7A1 ToF sensor, connected via Arduino pins.
I will eventually program it in Rust, but for the moment I am having trouble getting even the most basic functionality working with the C examples that go with the board. See e.g. https://github.com/STMicroelectronics/x-cube-tof1/tree/main/Projects/NUCLEO-F401RE/Examples/53L7A1/53L7A1_SimpleRanging
I don't have a Windows machine available to be able to try out the suggested GUI.
The USB connection from my computer to the board is through a powered hub, as earlier I noticed that without using the powered hub, the MCU would sometimes become unavailable (even without the sensor attached). The cable is USB-A to mini-USB (note: not micro).
I updated the STM32F401RE firmware to latest.
Without the sensor on top, the STM32F401RE is rock solid - always detected by STM32CubeProgrammer, and always reliably detected by probe-rs.
When I attach the sensor, I cannot get the Simple Ranging Example binary to work. When I stack the X-NUCLEO-53L7A1 on top of the STM32F401RE, USB connectivity through the ST-Link probe becomes, let's say, a bit unpredictable. Sometimes STM32CubeProgrammer detects it, sometimes not. Other probes (e.g. probe-rs) do not detect the nucleo MCU when the sensor is attached.
I made sure to fully erase the STM32F401RE's flash memory to ensure that my early coding experiments were not interfering with the ST-supplied binary example. I was able to flash the board with the sensor off, then re-attach the sensor and get a (extremely unreliable) serial connection over ST-Link USB. This showed a text interface with a cursor flying all over the place and a spot where "Distance [MM]" (I assume the ranging measurement) could go. No distance measurement appeared. But it was semi-encouraging as it seemed that the program was flashed properly.
The serial connection worked once in a few hours of trying. Mostly I was having trouble getting the board to communicate with my laptop.
My questions:
1) I assume that Nucleo-compatible hardware, like the STM32F401RE and X-NUCLEO-53L7A1, are supposed to work together and draw power from the ST-Link USB, without requiring some other source of power. Is that correct?
2) Does the behaviour above seem like a hardware problem? STM32F401RE progammability is rock solid until I attach the X-NUCLEO-53L7A1 at which point connectivity becomes flaky. I assume that having done a full erase before flashing, this isn't due to some software-defined pin conflict that is lingering on the board.
3) I assume that there are no solder bridges I need to enable, resistors to wire, etc? The STM32F401RE and X-NUCLEO-53L7A1 are listed as being compatible with each other, although it is worth saying I bought them separately, not as part of an evaluation kit. I saw some solder bridge-related discussion when it comes to I2C connectivity on some boards, could that be a problem?
I have also tried all of the above things with a STM32L476RG - same problems.