- Almost there but not quite.
With a lot of supportive guidance from Roger Clark, I have, over a short time managed to (almost) get my clone J-Link to talk to my STM32F103C8 development board.
I’m using the following;-
- LinuxMint 17.3
- Arduino IDE 1.6.10
- Arduino_STM32
The Commander script I have developed based on the original script developed for a Windows platform by Roger is;-
#
# Command file: jlink_upload - Linux Version
#
# Author: Nick KASPEROVIC - 20171016 (Version 0.0 - Draft)
## Original: Provided by Roger Clark / GitHub - 20161009 - Microsoft Version
# -----------------------------------------------------------------------------
#
# Modified: Nick KASPEROVIC (VK3TY) for use on Linux systems - 20161016
# -----------------------------------------------------------------------------# Check for a (mandatory) parameter as our local variable.
if [ "$#" -ne 1 ]; then
echo "*** ERROR: Missing a parameter/s during call."
exit
fiecho "*** "echo off
# Set a temporary file (with path) to a temporary variable.
tmpBinFilePath="$1"
echo "*** TRACE: \$tmpBinFilePath="$tmpBinFilePath
echo " "# Create a JLink Commander script file with the tmp bin that the Arduino IDE creates
echo loadbin $tmpBinFilePath , 0x1c000 > $tmpBinFilePath.jlink
echo r >> $tmpBinFilePath.jlink
echo q >> $tmpBinFilePath.jlink# Linux name given to original Windows based program JLink.exe.
JLinkExe -device STM32F103C8 -if SWD -speed auto -CommanderScript $tmpBinFilePath.jlink
I found on STM32, the MCU seems ro need to be erased before its reflashed, even though JLink is supposed to do this automatically.
It worked Ok for me on Windows, but I could not get the linux Jlinkexe binary to run, as it complained about missing some shared binary.
I think perhaps I need to load libusb.so or somtheing. Perhaps Segger have some docs for this?
SEGGER J-Link Commander V6.10e (Compiled Oct 14 2016 21:01:30)
Could not open J-Link shared library. Exiting now.
older jlink s/w for linux may be buggy (but that thread/post is years back, probably no longer valid info), if true 1 may need to use a more recent version. but like above those dynamic link libraries may be troublesome
older jlink s/w for linux may be buggy (but that thread/post is years back, probably no longer valid info), if true 1 may need to use a more recent version. but like above those dynamic link libraries may be troublesome
- I loaded my Linux version (6.10d) of the Segger file last week on to my LinumMint 17.3 64-bit lap-top. It works fine.
At the terminal;-
$ JLinkExe
SEGGER J-Link Commander V6.10d (Compiled Oct 6 2016 22:13:04)
DLL version V6.10d, compiled Oct 6 2016 22:12:56Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
Hardware version: V7.00
S/N: 20160703
License(s): RDI,FlashDL,FlashBP,JFlash,GDBFull
VTref = 3.300V
I don’t see any point in uninstalling what is currently working for me (5.12) and installing 6.10d, it would be better if I wait for 6.10f which I presume they will have to release soon when they realise 6.10e doesnt work correctly ![]()
The only thing I should probably do is pass the device type from Boards.txt via platform.txt to jlink_upload, as currently this is hard coded to STM32F103C8 and it would probably fail to upload binaries that were larger than 64k as this is the spec’ed flash size on the C8
(Note in practice the C8 often has 128k , as it looks like STM’s production yields are so high they don’t have enough flash failures to supply the demand of C8 devices, so just send out F103CB’s )
e.g.: dfu-util -d 1eaf:0003 -D file.bin
http://dfu-util.sourceforge.net/
this would need resetting the board and putting it in DFU mode though
(this thread, some of my initial struggles with the ‘buttons’ : https://www.olimex.com/forum/index.php?topic=5416.0)
i’d guess a way to identify if it has a ‘maple’ bootloader installed is in lsusb command if you are able to see the devices 1eaf:0003 (dfu mode) or 1eaf:0004 (serial tty mode)
this may help ‘work around’ the issue at least for a while and if this works while jlink doesn’t it may at least point to it being less of a ‘hardware’ issue and more an issue related to jlink itself.
the other way would be if you have windows say in a dual boot setup, to run jlink from windows to see if that works. (this may help to isolate a possible hardware issue vs a s/w issue)
the funky thing about ‘clone’ jlink is some of these ‘jlink clones’ is made of STM32F103C8 themselves (i.e. they also has a ‘firmware’ in it & it adds more complications to the picture)
http://www.ebay.com/itm/1PCS-Jlink-for- … SwPCVX3mbY
http://gronlier.fr/blog/2015/07/unbrick … -v8-clone/
come to think of it these ‘jlink clones’ may be used as ‘stripped down’ stm32 ‘maple clones’, add a ‘sketch’ & u can program it as jlink or easier usb to serial-ttl converter or any other ‘bit banging’ serial interface cable. e.g. usb-i2c, usb-spi, similar to those ftdi dongles ![]()
I agree, there is no reason to use JLink with this board at all, even on Linux, as this bootloader https://raw.githubusercontent.com/roger … 0_pc13.bin works fine.
But I guess in some circumstances people need the additional 8k that is taken by the bootloader and need to upload via USB Serial or a SWD debugger (e.g STLink or JLink or BMP)
come to think of it these ‘jlink clones’ may be used as ‘stripped down’ stm32 ‘maple clones’, add a ‘sketch’ & u can program it as jlink or easier usb to serial-ttl converter or any other ‘bit banging’ serial interface cable. e.g. usb-i2c, usb-spi, similar to those ftdi dongles
But I’d recommend that everyone buy striaght from Baite who are the main manufacturer, they have a store on AliExpress.
You are then pretty much guaranteed to not get a reject & reworked version.
imho stm32f103 even the ‘small’ c8 (64k flash, 20k ram) is relatively suitable for these usb-serial-ttl, usb-spi, usb-i2c ‘converters’ usage, comparable to those ftdi dongles as usb, uart, i2c, spi is built-in in stm32f103 series
- I downloaded the latest version 6.10e. not 6.10d – – – argh!
I must have downloaded mine sometime before you
. Checking, I have now downloaded and installed 6.10f. There’s no stopping me now.By the time I can type in the URL, I suspect it may be 6.10g or even 6.10k.
What progress. I remember when I last used the AVR ATMega328P – feels like yesterday. Come to think of it – it was yesterday (different project)
.
Rgds,
Nick
- I have now acquired some (IMO) worthwhile experience in the set-up and use of the STM32F103 using J-Link. Results are consistent and so far, no issues programming and using theh SMT32F103C8.
The big bonus has been in using Serial.println(); for tracing purposes. I can quickly program via the J-Link and, using the micro-USB serial connection plugged into another USB port, and have terminal messages displayed
.It behaves exactly like my Arduino Uno/Nano etc.
PS: J-Link 6.10g is now available. And here I was, trying to make a joke of the number of variations that were available in a short time.
I’m still not sure quite why you want to use Jlink, as most people , including those on Linux, just use the stm32duino-bootloader, which allows uploads via USB (using DFU)
- I guess it’s a case of “horses for courses”. For me, it works
. Simply, compile and upload. No further action required.
No need to add ancillary bits to my bought board/s. I just plug in the J-Link and the micro-USB serial port into my USB hub
everything works perfectly.No buttons to set/reset. For me, it is an easy approach and in keeping with the principles of KISS.
My collection of (currently 3 x STM32F103C8) is going to be complimented by a further 3 x STM32F103RBT6 units in the next two weeks. Each will be used in different projects so the ease of just plugging the J-Link into to the board out-ways any fiddling.
I am certain that I would still be contemplating what I was doing incorrectly without your support. Your comments and the comments of others on the forum have help me greatly.
If you install the bootloader ( e.g. using jlink), disconnect jlink.
connect usb
select the bootloader from the upload menu
press the compile and upload button
sketch is compiled and uploaded via usb
Actually. The bootloader upload is less stable than jlink, or stlink, or bmp upload, because if the code in you sketch crashes, it can kill the usb, in which case you have to press reset to upload again.
But most people live with that downside, as its not normally a problem, and it means they dont need to tie up another usb port and clutter things with another piece of hardware (jlink)

