cancel
Showing results for 
Search instead for 
Did you mean: 

the system does what I ask it to when the STLINK is connected to the PC via the USB. When I disconnect the usb and run the robot on its own, it does not perform the same way.

GLove.1
Associate II

Nucleo STM32F411RE, two VL53L0X, a DRV8833 driver and 2 6v motors. Power is from 2 x 3.7v18650 batteries (7.4v) on the VIN power input.

5v regulator powers the 2 sensors.

The batteries power the regulator, the VIN of the board and the motor driver.

I don't know what is cause the different action. I can reconnect the usb and the robot does what it is suppose to do.

I have the JP5 jumper on the E5V (pins 2 and 3) and JP1 is open.

regards,

gareth lovell

7 REPLIES 7
AScha.3
Chief III

>it does not perform the same way

what then...doing nothing ?

+

what happens on JP1 closed?

+

check - without USB - voltage VDD (at JP6) ;

check with scope clk on MCO , at SB50 or R25 ;

If you feel a post has answered your question, please click "Accept as Solution".
GLove.1
Associate II

thank you for your reply!

The sensors respond every time I trigger them with the usb connected and the motors do what I ask when I trigger the sensors.

The motors run sometimes and sort of **** tiny movements and the sensors repond only sometimes.

The front sensor is suppose to trigger the forward motion into reverse when the range is less than 300mm and go forward again when the range is greater than 700mm and it does it well on the bench but does drives for 4 seconds and "senses" and does a tiny **** in reverse and a tiny **** in forward on the floor. then just does tiny jerks every second or so. The red LED (LD1) flashes at the same time as the motors ****.

I haven't tried JP1 closed. I will do that now,

I will test the ideas you've provided.

Thank you again.

regards

gareth

Show the code.

Perhaps remove the NRST solder bridge so the ST-LINK doesn't reset the MCU.

Perhaps debug initalizes something you neglect, a GPIO or clock, for example.

Any other means of getting diagnostic output? Say a serial port via a USB to CMOS Serial dongle.

Sounds a bit like a power or short circuit / high current trip.

Check timing

Use LEDs rather than motors to observe. behaviour ​/ response expectations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
GLove.1
Associate II

thank you all for this.

I measured the voltage at JP6, it measures 2.6v on the multimeter.

I measure the timing on the SB50 resistor. on the scope:

period 19-21ms

freq 49-51Hz

I commented out all the debugging "printf" to the TeraTerm console that I was using to step through the code.

Maybe I should disable the UART?

I also made a couple of mistakes with the PCB and didn't use the correct pins for the Timers for PWM. I am using TIM2 for the left motor and TIM3_CH2 and TIM4_CH1 for the right motor.

I could solder a different set of pins to the motor driver to eliminate the third timer.

I use I2C1 for the two sensors, Pins PB8 and 9 and PC8 and 9 for the xshut pins.

I will check the grounding of everything. I think the sensors aren't grounded through the board. I almost think that the 5v out on the board might be enough for the sensors and I can not worry about the regulator.

is that NRST solder bridge the resistor SB12? do I just remove the resistor?

I noticed while I was scoping SB50, if I triggered the sensor while I had the probe on I could get the motors reversing and performing correctly. maybe it is a current problem?

I'll check the ground, the current and the software the maybe requires the STLINK

appreciate this.

thanks and regards,

gareth

GLove.1
Associate II

Hi, I attached main.c. It is kinda long and i'm not great at coding and optimisation. There is every chance that things could be written more efficiently etc.

There is a source and header for the I2C, the sensors and the systick.

i can include them if needed.

AScha.3
Chief III

>on the scope: period 19-21ms freq 49-51Hz

thats a missing ground connection - you see just some hum.

seems there is no 8MHz clk from the st-link F103 MCO.

has stlink power...VDD 3,3 stlink ? can check at JP1

and ground connected, stlink to f411 ? check. maybe cn11.12


_legacyfs_online_stmicro_images_0693W00000bl0JyQAI.png+ 2,6v --IF grounds all connected !! -- shows some overload on 3,3v line.

If you feel a post has answered your question, please click "Accept as Solution".
GLove.1
Associate II

yeah the signal looked pretty messy. and it seems to be "hunting" eee orrrr eeeee orrrr eeee orrrr" runs a bit faster when the LD1 flashes off and a bit slower when it flashes on. it doesn't do that when the usb is connected.

and the PWM isn't a square wave, it is square on a sine wave.

and I just scoped it with the usb connected. the waves are square and flat and the SB50 freq is 75Hz and a lot less noisy.