You are here
Home > embedded >

ATSAME54 Config File Using Openocd

Sometimes solutions are very simple. Openocd (Open On-Chip Debugger) is used on ubuntu for debugging and flashing programs to your target board. We are using SAM E54 Xplained Pro board. The problem started when we could not locate openocd config file for ATSAME54. After searching on google for a while we came to know that atsame5x.cfg we have to apply patch from openocd to get this working. As per openocd site they mentioned that support for ARM M4 series is added for microchip SAM D/E series controllers.

We have downloaded patch updated openocd and after running it using following command, could not connect to board and got same error.

$ openocd -f tcl/board/microchip_same54_xplained_pro.cfg 
Open On-Chip Debugger 0.10.0+dev-00409-g1ae106de (2019-03-18-12:24)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
none separate
adapter speed: 2000 kHz
cortex_m reset_config sysresetreq
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: unable to open CMSIS-DAP device 0x3eb:0x2111

At this time also we are unable to connect to board, we were constantly in touch with Microchip Support but they were also not getting answer to this. Their easy recommendation was :-

Customers are able to go ahead with the tutorial given in Microchip Developer Help.
There are no out of the box IDEs provided by Microchip for Linux, but a lot of people successfully installed Eclipse and used it for development including full debugging. So, you could get some good help from online forums.
We are sorry for not being much help on this. We cannot try it at our end.
Otherwise, you can install Windows through virtual box on a Linux Operating system and install the Atmel Studio on the virtual box.”

We are being startup company we do not want to invest in microsoft windows just to use Atmel studio, so we continued digging.

And the simple solution to this long going problem was use “sudo” . Neither Microchip website nor online forums mentioned about it. It was clear from the error that it was unable to open CMSIS-DAP device.

$ sudo openocd -f tcl/board/microchip_same54_xplained_pro.cfg 
Open On-Chip Debugger 0.10.0+dev-00409-g1ae106de (2019-03-18-12:24)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
none separate
adapter speed: 2000 kHz
cortex_m reset_config sysresetreq
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 2000 kHz
Info : SWD DPIDR 0x2ba01477
Info : same54.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections

To program your target board use

> sudo openocd -f tcl/board/microchip_same54_xplained_pro.cfg -c “program firmware.elf verify reset exit”

Leave a Reply

Top