cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading code / PWR Jumper - What am I doing wrong?

Thomas Weiss
Associate II
Posted on May 03, 2018 at 10:39

I am quite new to STM32 and never worked with a Nucleo before.  

I am trying to control two motors (from a hoverboard) with a Nucleo F446RE. I found a perfect example with libraries and example code on GitHub, but somehow ... it doesn't work.   

I am working after these wiring instructions... 

https://hackaday.io/project/13347/instructions

 

Wiring is definitely done correctly.

Using this as code... 

https://github.com/majinstudios/OpenChair/tree/master/Software

 

The problem is, that I am literally not getting any reaction from the motors, and I feel like it's neither a hardware, nor a software problem. More like ... I am doing something wrong about uploading / setting it up.

On the Hack-A-Day instructions, the PWR jumper is supposed to be set to E5V. While it's on E5V, I can't program the board without an external power supply. I tried both. Uploading with an external power supply attached and E5V, and uploading when jumpered to U5V. Uploading works, but I am getting some errors.  

[05/03/18 10:08:38] Processing nucleo_f446re (platform: ststm32; board: nucleo_f446re; framework: mbed)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option

PLATFORM: ST STM32 > ST Nucleo F446RE

SYSTEM: STM32F446RET6 180MHz 128KB RAM (512KB Flash)

DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)

Library Dependency Finder ->

https://community.st.com/bit.ly/configure-pio-ldf

LDF MODES: FINDER(chain) COMPATIBILITY(light)

Collected 16 compatible libraries

Scanning dependencies...

Dependency Graph

|-- <OpenChair>

Configuring upload protocol...

AVAILABLE: blackmagic, jlink, mbed, stlink

CURRENT: upload_protocol = stlink

Uploading .pioenvs\nucleo_f446re\firmware.elf

GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-15:03)

Licensed under GNU GPL v2

For bug reports, read

https://community.st.com/openocd.org/doc/doxygen/bugs.html

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

adapter speed: 2000 kHz

adapter_nsrst_delay: 100

none separate

srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : clock speed 1800 kHz

Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED

Info : STLINK v2 JTAG v30 API v2 SWIM v20 VID 0x0483 PID 0x374B

Info : using stlink api v2

Info : Target voltage: 3.262549

Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

Info : Listening on port 3333 for gdb connections

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

adapter speed: 1800 kHz

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x08001774 msp: 0x20020000

Info : Unable to match requested speed 8000 kHz, using 4000 kHz

Info : Unable to match requested speed 8000 kHz, using 4000 kHz

adapter speed: 4000 kHz

** Programming Started **

auto erase enabled

Info : device id = 0x10006421

Info : flash size = 512kbytes

target halted due to breakpoint, current mode: Thread

xPSR: 0x61000000 pc: 0x20000046 msp: 0x20020000

wrote 49152 bytes from file .pioenvs\nucleo_f446re\firmware.elf in 1.581122s (30.358 KiB/s)

** Programming Finished **

** Verify Started **

target halted due to breakpoint, current mode: Thread

xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000

target halted due to breakpoint, current mode: Thread

xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000

verified 46352 bytes in 0.207147s (218.519 KiB/s)

** Verified OK **

** Resetting Target **

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

adapter speed: 1800 kHz

shutdown command invoked

This is the console output from VSCode / PlatformIO when uploading.  

The code seems to run (I can see serial outputs about the analog sticks position), but sice I am trying to communicate with a mainboard ...   

  • Does it make a difference if I change from U5V to E5V after uploading my firmware?
  • Do the '

    Unable to match requested speed' lines mess up the function?

  • Is this 'libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED' important for it to work?

What else could I be doing wrong? My workflow so far is:  

  1. Use VSCode with PlatformIO

  2. Open the whole Software folder on Github as a project (it has a platformio.ini) including the library

  3. Select my MCU

  4. BUILD

  5. UPLOAD

What other info could I provide? What else can I try? I am trying to get this done as a part of a prototype for a presentation and basically just need this pre-done code to run on the nucleo.  

Any help is greatly appreciated!

#nucleo-f446re #vscode #platformio #stm32f4
5 REPLIES 5
Posted on May 03, 2018 at 23:01

Trying to run before learning to crawl?

Start with a blinky (blinking LED with loop delay).

JW

Posted on May 03, 2018 at 23:35

Does it make a difference if I change from U5V to E5V after uploading my firmware?

No.

Do the '

Unable to match requested speed' lines mess up the function?

No.

Is this 'libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED' important for it to work?

No. (I guess here, but as programming and verification apparently worked, it shouldn't be of significance).

If you are still uncertain whether programming went OK, you can also try to use the STLink Utility (or the new javoid which I don't favour so I don't even remember its name) as a tool for programming.

I am not going to find out the details of your (or someone else's) application, sorry.

JW

Posted on May 03, 2018 at 23:06

I actually started out with a blinky, which worked just fine. I am also aware of the fact, that this is not as easy as Arduino.     

I am just a bit short in time right now (got a presentation soon and an additional prototype would be nice), so I was hoping for an easy solution to my problem - or for a hint about what I am doing wrong here. On the long run, I am surely willing to learn how to run.

Posted on May 04, 2018 at 00:21

Thanks for the reply! I never intended to have anyone look into the details. This is only about the general way of uploading code to a STM32. Links were only provided to give a hint about the topic I am working on.  

I'll check out STLink Utility! Still a help to know that the errors I am getting aren't the actual problem. (Even tho I was kind of hoping they were so I could investigate).  

Have a nice evening, sir!

Posted on May 04, 2018 at 02:55

It's hard to gather my head around your entire project but something sounds like the input power which generates the E5V voltage is not working.  On most of the motor control shields I have used you must add external 12V-24V to them which then gets regulated down to the E5V pins...do you have this?