cancel
Showing results for 
Search instead for 
Did you mean: 

fresh Custom HID Project, not flashable on my STM32F4

juliuscaesar
Associate III
Posted on January 21, 2017 at 13:33

Hey guys,

I created 2 sets of projects with CubeMX for my STM32F429I-Disc 1 board.

I project is a Device HID project, the other one is a Device Custom HID project.

The Device HID projects works fine, the Custom HID project compiles correctly but will not flash onto my MCU.

I'm aware that for the custom HID USB routine to actually work, i'll have to adjust the USB descriptors. I have not done this yet!

However this problem looks like more severe problem to me. Is there something wrong with the cube MX code generation?

The log of the failed Custom HID looks like this

Open On-Chip Debugger 0.10.0-dev-00267-g884c33c (2016-03-16-12:22)

Licensed under GNU GPL v2

For bug reports, read

    

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fopenocd.org%2Fdoc%2Fdoxygen%2Fbugs.html

Info : auto-selecting first available session transport 'hla_swd'. To override use 'transport select <transport>'.

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

srst_only separate srst_nogate srst_open_drain connect_assert_srst

srst_only separate srst_nogate srst_open_drain connect_assert_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

Info : STLINK v2 JTAG v25 API v2 SWIM v14 VID 0x0483 PID 0x374B

Info : using stlink api v2

Info : Target voltage: 2.867916

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

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

stm32f4x.cpu: target state: halted

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

xPSR: 0x01000000 pc: 0x08000250 msp: 0x20030000

configuring PLL

** Programming Started **

auto erase enabled

Error: Invalid command argument

image.base_address option value ('Test.elf') is not valid

** Programming Failed **

shutdown command invoked

and this  is the log of the working HID Device

Open On-Chip Debugger 0.10.0-dev-00267-g884c33c (2016-03-16-12:22)

Licensed under GNU GPL v2

For bug reports, read

    

https://community.st.com/external-link.jspa?url=http%3A%2F%2Fopenocd.org%2Fdoc%2Fdoxygen%2Fbugs.html

Info : auto-selecting first available session transport 'hla_swd'. To override use 'transport select <transport>'.

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

srst_only separate srst_nogate srst_open_drain connect_assert_srst

srst_only separate srst_nogate srst_open_drain connect_assert_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

Info : STLINK v2 JTAG v25 API v2 SWIM v14 VID 0x0483 PID 0x374B

Info : using stlink api v2

Info : Target voltage: 2.867916

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

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

stm32f4x.cpu: target state: halted

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

xPSR: 0x01000000 pc: 0x08000250 msp: 0x20030000

configuring PLL

** Programming Started **

auto erase enabled

Info : device id = 0x20016419

Info : flash size = 2048kbytes

stm32f4x.cpu: target state: halted

target halted due to breakpoint, current mode: Thread

xPSR: 0x61000000 pc: 0x20000046 msp: 0x20030000

wrote 262144 bytes from file Debug/Giessomat.elf in 7.384422s (34.668 KiB/s)

** Programming Finished **

** Verify Started **

stm32f4x.cpu: target state: halted

target halted due to breakpoint, current mode: Thread

xPSR: 0x61000000 pc: 0x2000002e msp: 0x20030000

stm32f4x.cpu: target state: halted

target halted due to breakpoint, current mode: Thread

xPSR: 0x61000000 pc: 0x2000002e msp: 0x20030000

verified 213980 bytes in 1.634094s (127.878 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

do you have any idea how to solve the problem?

greets Julian

1 ACCEPTED SOLUTION

Accepted Solutions
nichtgedacht
Senior
Posted on February 22, 2017 at 02:50

Hi

This error happens if the file name presented to the OpenOCD binary with the '-c program ...' option contains spaces.

The excess word is interpreted as offset assumed to override the base address in the .elf header.

Dieter

View solution in original post

7 REPLIES 7
Posted on January 21, 2017 at 15:03

If pulling BOOT0 High solves the problem you need to look more critically at what your code is doing with the GPIO pins used for JTAG/SWD connectivity, or going into a low power mode.

Check also behaviour with the ST-LINK Utilities

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
juliuscaesar
Associate III
Posted on January 24, 2017 at 22:20

Do you mean by actually applying a 5V signal to the BOOT0 pin, or is it possible to do this via software as well?

I checked the behaviour with ST Link Utilities.

The wired part is, that when flashing to bin file with ST Link Utilities everything worked fine. My greed LED is blinking as well, so the program is running.

If i try the same with SW4STM32 the LED is not blinking at all.

So the problem is somewhere within the SW4STM32 settings. Do you have any idea where to start looking?

juliuscaesar
Associate III
Posted on January 24, 2017 at 22:41

alright I will have to do this at my work place since I don't have a Power Supply at home

SW4STM32 (based on eclipse) creates both, an elf file and a binary file. The elf file probably contains debugging informations.

I cleaned to complete project and made a rebuild to regenerate both the elf file and bin file.

However to problem still exists.

What do you mean by connecting as SWD. I don't have an external debugger, i'm using the on circuit debugger with my discovery board

Posted on January 24, 2017 at 22:27

Pull it to 3V or VDD, you can change the mapping in software but the point was to make sure it was not related to code on the part. Not sure it is 5V tolerant.

Make sure you update the ST-LINK firmware using the utilities. Make sure you update the DLL or whatever SW4STM32 is using. Make sure it connects as SWD

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 24, 2017 at 23:20

Seem to recall in Keil I have the ability to select JTAG mode or SWD mode for the ST-LINK, it is agnostic to whether it is on a DISCO or not. It will however fail in JTAG mode.

Yes the .ELF typically contains the symbols and debug metadata, this doesn't get downloaded to the part however.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
nichtgedacht
Senior
Posted on February 22, 2017 at 02:50

Hi

This error happens if the file name presented to the OpenOCD binary with the '-c program ...' option contains spaces.

The excess word is interpreted as offset assumed to override the base address in the .elf header.

Dieter

juliuscaesar
Associate III
Posted on February 26, 2017 at 10:37

Hi,

thx for your replay, that did actually solve my problem. Thx for your help!