Page 1 of 2

STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 12:06 am
by tfAteba
Hi,

I want to know if some of you have try to program the nucleo32 board with the mcu STM32L011K4.

I can't by using the folowing methods:

  • st-flash
  • st-utils
  • openocd

Here are the resulting errors I got:
st-util
2016-12-22T23:37:14 INFO src/stlink-common.c: Loading device parameters....
2016-12-22T23:37:14 WARN src/stlink-common.c: unknown chip id! 0x10086457


st-flash write build/ch.bin 0x8000000
2016-12-22T23:37:48 INFO src/stlink-common.c: Loading device parameters....
2016-12-22T23:37:48 WARN src/stlink-common.c: unknown chip id! 0x10086457



openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32l0.cfg
Open On-Chip Debugger 0.10.0-dev-00322-g406f4d1 (2016-06-18-08:00)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
adapter speed: 300 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : clock speed 240 kHz
Error: open failed
in procedure 'init'
in procedure 'ocd_bouncer'


The st-* tools don't seems to kown this chip and I'm not used to openocd. :) So I need a bit help thanks.

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 1:24 am
by RoccoMarco
I encountered this problem and also solved.
You need to remove test suite since the binary is greater than memory size and this will solve problems with stlink utility.

Indeed I created a demo with nil for stm32l011 instead of rt. I also remember I gad to create a custom cfg file for open ocd but I have lost it. I will make some test, creating the cfg again and adding it in the openocd released through play embedded.

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 10:23 am
by tfAteba
Hi RM,

You need to remove test suite since the binary is greater than memory size and this will solve problems with stlink utility.
RoccoMarco


I already did that yesterday, effectivelly I also make that constat that I need to remove the test suite.

But I still can't use st-util. I will a try again and see if I can resolve this problem.


Indeed I created a demo with nil for stm32l011 instead of rt. I also remember I gad to create a custom cfg file for open ocd but I have lost it. I will make some test, creating the cfg again and adding it in the openocd released through play embedded.
RoccoMarco


Thanks for the hint, I will try to make an openocd config file but not really sure I can manage that :).

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 10:34 am
by tfAteba
Sorry I forgot about this :D ,

It is then better to use NIL as you said rather than RT because of the low flash size of the mcu.

In my RT example, I can just blink a LED in the main thread, I don't have the size to create another thread because the size of the binary become greater than the size available on the chip.

I will then try to use NIL for this board so that I still have a little place for my application program :).

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 4:27 pm
by RoccoMarco
If you switch on trunk there is a demo
NIL-STM32L011K4-NUCLEO32

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 6:06 pm
by tfAteba
Really nice RM,

Thank you for the demo, so I just now have to focus on the openocd configuration file to be able to flash mcu.

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 6:25 pm
by tfAteba
May be if can be helpful to some one else.

For the moment, to program the board, I use the old way :lol: :
When I plug the Nucleo32 board, it appears like a usb dongle named NODE_L011K4, so I copy the binary (build/ch.bin) to it.
The binary file is loaded and executed immediately :P it is magic!

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 6:28 pm
by RoccoMarco
Is not magic, is the bootloader on the USB-MSC. The peripheral you are seeing is actually the flash of the microcontroller managed through the bootloader. This mechanism is the same used by ARM mbed.

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 6:37 pm
by tfAteba
Thank you for these clear explanations, now I understand what happens under the beast.

Re: STM32L011K4 st-flash problem

Posted: Fri Dec 23, 2016 6:41 pm
by RoccoMarco
I am not at home so I haven't with me a Nucleo 32 L011. BTW I know where to dig to find out information. I'll create a cfg so you can test it. Hear you later.