I tried building the SDK and flashing an image with “make flash”. But something went wrong during the process, and now I cannot connect to the device using JLink anymore – each time I get errors (on both KM0 and KM4):
JLinkGDBServer -device cortex-m23 -if SWD -scriptfile AP1_KM0.JLinkScript -port 2331
SEGGER J-Link GDB Server V6.86g Command Line Version
JLinkARM.dll V6.86g (DLL compiled Nov 6 2020 18:12:00)
Command line: -device cortex-m23 -if SWD -scriptfile AP1_KM0.JLinkScript -port 2331
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: AP1_KM0.JLinkScript
J-Link settings file: none
------Target related settings------
Target device: cortex-m23
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V11 compiled Dec 11 2020 15:39:51
Hardware: V11.00
S/N: XXXXXXXXXX
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.45 V
Listening on TCP/IP port 2331
Connecting to target...
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...
Could not connect to target.
Please check power, connection and settings.logjammin:jlink_script rob$
Since all the tools for flashing require the JLink to connect, I don’t know how to restore this board to a working condition.
Have you tried using the image tool?
compile and build a basic image with “make all”, and upload the image using a USB cable with ImageTool.exe that can be found in the tools folder.
more information on how to use the image tool can be found in chapter 8 of the AN0400 Application note.
I had not tried image tool, mostly because I don’t use Windows. So this morning, I downloaded and installed a Windows VM this morning, and used ImageTool – but it is not working, either.
I get messages that the COM port was opened, the UART download was started and that the COM port was closed.
But there is no progress bar movement – and it seems to happen way too fast for it to have actually downloaded and flashed the images.
COM3 is open successfully!
Uart download server has started...
COM3 is closed successfully!
I let it sit for awhile, but nothing seems to happen (save for the LED blinking about every 2s).
I’ve tried to repeat the process, but it never works. It looks like the device exits UART download mode without really doing anything.
COM3 is open successfully!
Uart download server has started...
COM3 is closed successfully!
COM3 is open successfully!
Uart download server has started...
COM3 is closed successfully!
COM3 is open successfully!
Uart download server has started...
COM3 is closed successfully!
In the meantime, I was able to get JLink to connect to my system, but it looks like the flash on my device has been completely wiped out:
I suspect that the image tool might not have sent any image over, this is what I get in the image tool on a normal image upload
COM9 is open successfully!
Uart download server has started…
Erase addr: 0x8000000, size:8KB
Erase addr: 0x8004000, size:8KB
Erase addr: 0x8006000, size:784KB
IMG1 image is being sent…
IMG1 image has been sent successfully!
IMG3 image is being sent…
IMG3 image has been sent successfully!
IMG4 image is being sent…
IMG4 image has been sent successfully!
All images are sent successfully!
COM9 is closed successfully!
just to verify, did you hold down the UART_DOWNLOAD button while pressing and releasing the RESET button? this should put the board in UART_DOWNLOAD mode to allow the image tool to send it over.
After the image tool is done, press and release the RESET button only to exit UART_DOWNLOAD mode and start running the image.
On the other hand, seeing that JLink managed to connect to the device, does that mean your original issue has been resolved? or are there still other issues with the board?
Yes, I did exactly those steps. I was not able to get ImageTool to work.
However, the process of putting the device into UART download mode (holding UART_DOWNLOAD button, pressing reset button) allowed the JLink to connect to the device. Once that worked, I’ve been able to use GDB scripts to get working images flashed onto the device.
I don’t know why ImageTool would not load the images (I am wondering if there’s some documentation I missed about using a different USB connector on the board maybe?), but in the end, I’m somewhat glad that I failed, as I’ve now been able to get the other tools working.
Hi
I was encounter this situation in the past.
By a mistake - I programmed the KM0 with KM4 code…
Thus, my solution was to reprogram the KM0 bootloader, and after, everything became as it should be
I hope that helps!