ST-LinkV2 work perfectly when M0517 is unlocked. It seem that flashing process on the same freq. is faster then with Bu-link. Other good thing is that TxSoftSerial work over temp sensor port with ST-LinkV2 power only, and LCD display is more readable than with Bu-link power. Last night i downloded an instal Keil mVision V5.12.0.0 and tray to unlock M0517 but unfortunately without success. It is not possible to start debug session when CPU is locked. When CPU in not locked, unlock procedure work as described on this link. Did you tray to unlock M0517 with your STM32F4DISCOVERY board? |
ST-LinkV2 work perfectly when M0517 is unlocked. It seem that flashing process on the same freq. is faster then with Bu-link. Other good thing is that TxSoftSerial work over temp sensor port with ST-LinkV2 power only, and LCD display is more readable than with Bu-link power.
Last night i downloded an instal Keil mVision V5.12.0.0 and tray to unlock M0517 but unfortunately without success. It is not possible to start debug session when CPU is locked. When CPU in not locked
, unlock procedure work as described on this link.
Did you tray to unlock M0517 with your STM32F4DISCOVERY board?
2014-12-02 1:01 GMT+01:00 sasam <sasa.mi...@gmail.com>:
ST-LinkV2 work perfectly when M0517 is unlocked. It seem that flashing process on the same freq. is faster then with Bu-link. Other good thing is that TxSoftSerial work over temp sensor port with ST-LinkV2 power only, and LCD display is more readable than with Bu-link power.
Last night i downloded an instal Keil mVision V5.12.0.0 and tray to unlock M0517 but unfortunately without success. It is not possible to start debug session when CPU is locked. When CPU in not lockedThat's bad news, I hoped that we even could download the firmware with some debugger hacking.
, unlock procedure work as described on this link.
Did you tray to unlock M0517 with your STM32F4DISCOVERY board? not yet, I will play with it this weekend.
Good news!
I sucesfuly erased locked M0517 with Keil, and flash it again with ST-LinkV2 (CooCox CoIDE&CoFlash). RST pin on M0517 I connected to SWIM_RST (pin 9 on my ST-LinkV2), and in Keil debug config I set HW RESET for reset type.
This action I performed with ST-LinkV2 like this: http://www.aliexpress.com/item/Free-Shipping-1SET-ST-Link-st-link-V2-for-STM8S-STM8L-STM32-Cortex-M0-Cortex-M3/1758613434.html
On e-bay you can find somethng like this: http://www.ebay.com/itm/ST-Link-V2-mini-STM8-STM32-Emulator-Downloader-Programming-Unit-Random-Color-/141487196483?pt=LH_DefaultDomain_0&hash=item20f14b4943
Pin out is little bit different but all pin what we need is there, and probably work.
On Aliexpress: http://www.aliexpress.com/premium/ST%25252dlink-V2.html?g=y&needQuery=n&isFreeShip=y&SearchText=ST-link%2BV2&CatId=0&shipCountry=hr&initiative_id=SB_20141202161540&isRtl=yes&SortType=price_asc&filterCat=400103,4099,515&groupsort=1
Hi guys,So if I buy one of this ST-Link V2 mini, I should be able to erase the locked M0517, but what about flashing it with the cheali-charger alternative firmware? Would it be possible to flash it or I would need the STM32F4DISCOVERY board?
What other boards can be used for flashing/erasing beside Bu-Link and ST-Link?
Thank you.
Last few days I have been playing with this dongle & OpenOCD under my VMware Lubuntu. I wrote TCL script to flash image (init, erase, flash, validate) and it lasts only 6s (to flash last ARM version of cheali-charger) :-) . Pawel patch for OpenOCD is not needed for this procedure so I hope it can be possible to use last Win version of OpenOCD.
Last few days I have been playing with this dongle & OpenOCD under my VMware Lubuntu. I wrote TCL script to flash image (init, erase, flash, validate) and it lasts only 6s (to flash last ARM version of cheali-charger) :-) . Pawel patch for OpenOCD is not needed for this procedure so I hope it can be possible to use last Win version of OpenOCD.
I successfully flash cheali-charger with windows OpenOCD (0.8.0) & ST-Link V2 on my Win7 laptop. It need only 4s to flash image. For time measurement I used TCL command "clock".
OpenOCD TCL script is the same as on Linux. I must instaled GnuWin32_CoreUtils because in script I am using unix commands "split" and "rm". Driver for ST-Link V2 is native ST driver (st-link_v2_usbdriver.exe)
Instructions for OpenOCD installation on windows can be found here: http://gnuarmeclipse.livius.net/blog/openocd-install/
I will put more detail in this thread OpenOCD support for nuvoton M0516LBN CPU.
Maybe a github project for that? (or some other site)It would be easier for me to link to it.
openocd-0.8.0.exe -f interface/stlink-v2.cfg -f target_M0517_win.tcl
openocd-0.8.0.exe -f interface/stlink-v2.cfg -f target_M0517_win.cfg
target_M0517_win.tcl to
target_M0517_win.cfg
openocd-0.8.0.exe -f interface/stlink-v2.cfg -f target_M0517_win.cfg
connect to openocd telnet port 4444 for example with putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/) (telnet,localhost, port 4444)source M0517_flash.tcl ReadConf EraseChip WriteConf
for flash:
source M0517_flash.tcl
FlashAprom binary_file_you_wont_to_flash
Hello, guys! I'm deeply interested in this topic, you are making a great job!As for me I've ordered and already received ST link V2. Also i have a Nuvoton based charger with board revision 2. So my plan is'n only to flash it to cheali charger but to make a video or text manual how to do it in a most simple way and gieve it to you to help other people without much knowlege in cortexes and nuvotons. (as for me i'm atmega user)Yesterday I tried to connect ST link and charger as its described previously and tryed to use a OpenOCD manual to flash it. But on the very first step i received a warning that target_M0517_win.tcl cant be found. In TCL folder this file also not present.
You can also put -s options with folder where you put scripts (M0517_flash.tcl,
M0517_unlock.tcl,
target_M0517_win.cfg)
My quiestion is: do we need only follow M0517_flash_tools manual to flash nuvoton by cheali charger. Can you describe steps to flash charger without compiling anythig but using just .hex or .bin ?
I've tried openocd-0.8.0.exe -f interface/stlink-v2.cfg -f target_M0517_win.tcl and it woun't starts as service, here, what i have:
D:\get\openocd-0.8.0\bin>openocd-0.8.0.exe -f interface/stlink-v2.cfg -f target_
M0517_win.tcl
Open On-Chip Debugger 0.8.0 (2014-04-28-08:39)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
0
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.471484
Error: init mode failed
in procedure 'transport'
in procedure 'init'
D:\get\openocd-0.8.0\bin>
Hi Sasam,I finally tested your implementation and I must say I'm speechless!I didn't had to configure anything, I just run ./progStLink2.sh,programming took 2.5s on linux (vs. 20s for my solution).It's ideal for debugging!
can I marge this into my branch?
hm... although I'm not sure if your implementation should be buried in thecheali-charger source tree, it's just to good for that,You probably should make a separate project for it,or propose it to the openOCD project.
Also some function send output to stderr and some to stdout and some to booth. On some function you must put prefilx ocd_ if you wish output to stdout...Finlay I succeed with TCL. I think it is good solution becaus it work with native OpenOCD version without patch.
Of course, you can merge, change and improve it.
I don't know is this folder: https://github.com/sasam/cheali-charger/tree/linux_flash_test/utils/M0517_flash_tools right place for this code. There is, source code for ARM-flash function, TCL script and config for OpenOCD.
In https://github.com/sasam/cheali-charger/tree/linux_flash_test/src/hardware/nuvoton-M0517/targets/imaxB6-clone I put OpenOCD TCL scripts & config, ARM-flash binary and bash script for backup & flash. Now we have same files on 2 place, probably this is not good idea.
Dana četvrtak, 19. veljače 2015. u 03:39:01 UTC+1, korisnik sasam napisao je:
Dana srijeda, 18. veljače 2015. u 21:03:04 UTC+1, korisnik cheali-charger napisao je:2015-02-07 23:21 GMT+01:00 sasam <sasa.mi...@gmail.com>:Of course, you can merge, change and improve it.
I don't know is this folder: https://github.com/sasam/cheali-charger/tree/linux_flash_test/utils/M0517_flash_tools right place for this code. There is, source code for ARM-flash function, TCL script and config for OpenOCD.
In https://github.com/sasam/cheali-charger/tree/linux_flash_test/src/hardware/nuvoton-M0517/targets/imaxB6-clone I put OpenOCD TCL scripts & config, ARM-flash binary and bash script for backup & flash. Now we have same files on 2 place, probably this is not good idea.hmm... I've noticed that we can only flash *.bin files, and I'm only publishing hex files,as far as I understand it's because we are splitting the file with the "split" bash command?I've also looked at the OpenOCD documentation:"Command: load_image filename address [[bin|ihex|elf|s19] min_addr max_length]"maybe this function can be used to split the file?
I looked this function but i didn't find solution how-to load each part of image file to RAM for flash. What do you think for idea to write small program for split bin or hex file into parts for flash ? or just one function for conversion hex file to binary file.
I have that motherboard (2.0) - https://github.com/stawel/cheali-charger/blob/master/docs/imaxB6_nuvoton-M0517/imaxB6-clone-nuvoton-front.jpg
In your picture you have 1.8. I won't give my head for that, but seams that layout and pins are the same.
Seams the same... you can check it with multimeter if needed. More info and history of getting cheali charger to M0517 - https://groups.google.com/forum/#!msg/cheali-charger/VATJQ4-GpVE/E-T_Mzhl3mgJ
I added pic how I made my connections. Didn't connect anything else.Powered the board with 5V from st-link dongle.I hope it helps.
You wont to unlock charger of flash new FW?
As I know it is not possible to restore original FW. For unlock you must erase original FW.
Few days ago Pawel introduce patch for M0517_flash.tcl which add support for hex file and also eliminate need for unix commands which I used.I will try to write small script for win and linux to automate OpenOCD erase process, and maybe flash process for win.
Existing script for automate flash on linux is OK.
Best regards,
Saša
I thing that RST line on ST-LinkV2 is not needed to be connected. But I will try again when will try to write automation script for erase & unlock.
install Xcode from AppStore
open Xcode and install additional components (if open first time)
you may close Xcode and open Terminal
sudo xcodebuild -license
#enter your password
#press space until you reach the bottom of the license
#type agree and confirm
xcode-select --install
#confirm installation of command-line tools in window that pops up
download MacPorts for OS X 10.10 Yosemite (or whatever version of OS X you are using)
# click on the installer and make a standard install (it can take a while)
go back to Terminal
sudo port install libtool automake autoconf pkgconfig wget cmake boost libconfuse swig-python texinfo texlive
#enter your password if prompted
#wait for installation to complete (can (and should!) take a very long time)
curl -L https://sourceforge.net/p/gnuarmeclipse/openocd/ci/gnuarmeclipse/tree/gnuarmeclipse/scripts/build-openocd-osx.sh?format=raw -o ~/Downloads/build-openocd-osx.sh
bash ~/Downloads/build-openocd-osx.sh
this will create an installer in your home folder ▸ Work ▸ openocd ▸ output
execute and install it. then go back to terminal
/Applications/GNU\ ARM\ Eclipse/OpenOCD/bin/openocd --version
this should give an output like this:
GNU ARM Eclipse 64-bit Open On-Chip Debugger 0.8.0 (2015-02-24-15:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
if you see this, you can delete that Work folder by typing
rm -rf ~/Work/openocd/
this does not remove the Work folder (since maybe some people actually had one before and don’t want to delete it.. but it removes everything else we just stored there
cd ~/Work/
git clone https://github.com/sasam/M0517_flash_tools.git
----
now, launching
/Applications/GNU\ ARM\ Eclipse/OpenOCD/bin/openocd -f interface/stlink-v2.cfg -f target_MO517_linux.tcl
gives me
GNU ARM Eclipse 64-bit Open On-Chip Debugger 0.8.0 (2015-02-24-15:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Error: Invalid command argument
Runtime Error: embedded:startup.tcl:20: -chain-position required when creating target
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'target' called at file "target_MO517_linux.tcl", line 37
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 20
and trying the win configuration script gives me
GNU ARM Eclipse 64-bit Open On-Chip Debugger 0.8.0 (2015-02-24-15:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
0
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.215213
Error: init mode failed
in procedure 'transport'
in procedure 'init'
the win configuration seems to work a little better, you can see it has detected the STLINK and then cannot connect to the processor. As to why it cannot find the -chain-position argument in the linux script, I wanted to ask for help. This does not make any sense for me. It seems I am severely stuck at this point.
Thank you,
Philipp
Hi guys,first of all, thank you for your exciting work! This is very interesting for me.I want to ask for help, though.I have bought an ST-LINK V2 and connected it to my Nuvoton board as per description. The STLINK shows a green light and the charger powers up and then shows me an input vol error (I guess that's expected).However, I cannot connect to it. Everything works up to the point when I try to launch openocd with the configuration files provided.Now, since I wanted to contribute a litte to the documentation I have started to write a small howto, this is how it looks so far (and is what I did so far)I have to say that I work on OS X 10.10----
Did you instal last STM32 ST-LINK Utility_v3.5.exe and flash last FW on your ST-LINK V2 ?
When you connect it on PC what you see in device manager ?
and trying the win configuration script gives me
GNU ARM Eclipse 64-bit Open On-Chip Debugger 0.8.0 (2015-02-24-15:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
0
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.215213
Error: init mode failed
in procedure 'transport'
in procedure 'init'
I have to say that I work on OS X 10.10
the win configuration seems to work a little better, you can see it has detected the STLINK and then cannot connect to the processor. As to why it cannot find the -chain-position argument in the linux script, I wanted to ask for help. This does not make any sense for me. It seems I am severely stuck at this point.
Take a look at this little how to - https://github.com/stawel/cheali-charger/blob/master/docs/Flashing%20m0517.docit says what you have to do with your last error:
It turns out that it's possible to program a nuvoton M0517 CPU chargerwith a STM32F4DISCOVERY board.Unfortunately I wasn't able to disable the flash "security bit" withthis configuration, so the bu-link is still required for the firstflash cleaning.more info in this thread:Best Regards,Paweł
Wired it up, However, is it correct that Vdd is connected to the 3.3v pad on the charger? i had 1 ohm resistance between the pad, and the vdd pin.
Whereas the 5v pad on the bottom had infinity resistance towards Vdd.I don't want to fry the processor now that iv managed to do the soldering.
Well that sucks, going to have to trash it then.
What is it that tells its not a nuvuton? the vdd being connected to the 3.3v pad?
It turns out that it's possible to program a nuvoton M0517 CPU chargerwith a STM32F4DISCOVERY board.Unfortunately I wasn't able to disable the flash "security bit" withthis configuration, so the bu-link is still required for the firstflash cleaning.more info in this thread:Best Regards,Paweł
$ ./openocd.exe -f ../scripts/interface/stlink-v2.cfg -f target_M0517_win.cfgOpen On-Chip Debugger 0.9.0 (2015-05-19-12:06)
Licensed under GNU GPL v2For bug reports, read
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.Warn : Transport "hla_swd" was already selectedError: The selected transport doesn't support this targetembedded:startup.tcl:21: Error: invalid command name "M0517.cpu"in procedure 'script'at file "embedded:startup.tcl", line 60in procedure 'target' called at file "target_M0517_win.cfg", line 13in procedure 'ocd_bouncer'at file "embedded:startup.tcl", line 21
Same error with ../scripts/target/m051.cfg
Are you sure that you have made a "manual hardware reset" on the IMAX B6. The trick is described here https://groups.google.com/forum/#!topic/cheali-charger/P8eFl5f6jpc