ST-Link V2 on Linux/OSX/Windows

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Jacon
Posts: 143
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 50 times
Been thanked: 5 times

Re: ST-Link V2 on Linux

Post by Jacon »

And a good one - working like a charm here :mrgreen:
(WinXP SP3)

Jacek
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux

Post by mobyfab »

I still had a version of QT 4.7.3 I had compiled statically for MSVC 2010 so it took me like 20 minutes to modify the code. :mrgreen:
libusb is compiled statically as well so no messing with DLLs, it's much easier.

I'll make a CLI version for windows since it's not possible to choose at runtime here.
User avatar
Giovanni
Site Admin
Posts: 14894
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by Giovanni »

May I suggest to use "normal" CLI parameters preceeded by '-' ?

For example
-e erase
-p program
-v verify (the exit code 0 would mean correct verification, 1 verify error).
-ln verbose level (0 = silent)
-r reset and run

This could become a good multi-platform tool for batch regression testing.

Giovanni
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by mobyfab »

Yeah I can do this :)

Pushed a new version of the exe, there was a small error in the code that prevented the files to be written correctly to disk when dumping the content of the flash.

Also, there is no need to run the program as root anymore if you add the required udev rules (pushed to svn)
Jacon
Posts: 143
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 50 times
Been thanked: 5 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by Jacon »

Hmm...

When I connect to my STM32F4-Discovery and make some tests on previously
downloaded firmware (get info, MCU halt-reset-run) everything seems to look
OK.
But when I Send new firmware, I must disconnect USB cable from PC to
recreate proper operation of Discovery board - it stops responding to anything,
hard Reset button included ;)
None of possible operations from your application change state of the board!

It looks like bug in ending of firmware send.

Test firmware files checked with original ST-LinkV2 application - no problems
at all.

BTW - Receive worked & ended perfect.
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by mobyfab »

Yes my card has the same behavior, in most cases I need to replug it to have the board work with the new firmware.
Don't know how to "hard reset" it, seems like the reset System/Core doesn't work properly...

edit: It should work now :) I have done some reverse engineering on the official tool.
Jacon
Posts: 143
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 50 times
Been thanked: 5 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by Jacon »

Downloaded latest version 10 minutes ago - the same bad behaviour as before :?
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by mobyfab »

That's odd, I just tested and it worked fine...

Try to re-download the last version.
Jacon
Posts: 143
Joined: Wed Dec 08, 2010 7:52 am
Has thanked: 50 times
Been thanked: 5 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by Jacon »

Nope - seems to me that STLink is steady connected to host MCU after Send,
because I can receive just sent firmware, disconnect, leave & restart your
application, connect back & receive again etc - everything here is OK.

But to start my host application, i must reconnect USB cable...
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: ST-Link V2 on Linux/OSX/Windows

Post by mobyfab »

I have done some modifications, it should work now.

I have done some tests on both Windows and Linux, it works fine.
I have uploaded the demonstration FW then the ChibiOS FW, both programs start right after writing to flash.
Post Reply