March 28, 2024, 07:56:10 PM

ARM-USB-TINY-H and openOCD

Started by anis19, April 11, 2016, 05:17:28 PM

Previous topic - Next topic

anis19

Hello,
I am tryig to program a device (Sensor named Intel Imote2) through it's JTAG interface.
I am using Olimex ARM-USB-TINY-H. I installed different versions of OPENOCD (0.4 & 0.6 & 0.9) and diffent libraries like libUSB, FTDI & FT2232 and i keep having troubles.
when i run : openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f board/crossbow_tech_imote2.cfg
i get the following :
Open On-Chip Debugger 0.9.0 (2016-04-11-10:37)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
adapter speed: 6000 kHz
adapter_nsrst_delay: 260
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
jtag_ntrst_delay: 250
Info : imote2.cpu: hardware has 2 breakpoints and 2 watchpoints
adapter_nsrst_delay: 800
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Info : clock speed 6000 kHz
Info : JTAG tap: imote2.cpu tap/device found: 0x79265013 (mfg: 0x009, part: 0x9265, ver: 0x7)

i checked in some links in internet and this seem to be the good output. Still there is a problem somewhere.
I am note very used to this kind of stuffs so my post may seem not realy clear i know :(
I would like to know how to check if everything is okey with my configuration (OpenOCD + ARM-USB-TINY-H )

Thanks

JohnS

#1
Looks OK.  What's the problem?

BTW, If you actually do have a problem, the oocd ML is probably a far better place to post.  They'll want -d3 output.

John

anis19

Hi,
The problem is that when i try to put a program on my target using : sudo make intelmote2 install openocd
the program is correctly compiled locally, then i get this output :
Programming imote2 with binary: build/intelmote2/main.bin.out-100
Starting OpenOCD...

and it hangs like that ...
when i tape CTRL+C i get : RuntimeError: Did not receive expected pattern 'JTAG device found:'

(PS: i am new in the forum also could you please explain me with more details where i can find some help, i didn't understand what you advised in the previous message)
Thank you

JohnS

I think you should not be using sudo

Look at the makefile / run with some debug and figure what it's doing then issue the command(s) individually to see what fails & why.

You almost for sure need openocd -d3 to get closer to what fails.

openocd has a ML (mailing list) for users / developers to ask things, though this looks like oocd is working but the makefile etc you use are failing.  So debug the makefile etc.  Ask about it/them wherever you got it/them!

John

anis19

This is what i get when i run : openocd -d3
Open On-Chip Debugger 0.9.0 (2016-04-11-10:37)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
User : 13 29 command.c:546 command_print(): debug_level: 3
Debug: 14 30 options.c:98 add_default_dirs(): bindir=/usr/local/bin
Debug: 15 30 options.c:99 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
Debug: 16 30 options.c:100 add_default_dirs(): run_prefix=
Debug: 17 30 configuration.c:44 add_script_search_dir(): adding /home/harfouche/.openocd
Debug: 18 31 configuration.c:44 add_script_search_dir(): adding /usr/local/share/openocd/site
Debug: 19 31 configuration.c:44 add_script_search_dir(): adding /usr/local/share/openocd/scripts
User : 20 32 command.c:689 command_run_line(): embedded:startup.tcl:60: Error: Can't find openocd.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 60
Debug: 21 32 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 22 33 command.c:145 script_debug(): command - init ocd_init
Debug: 24 33 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 25 33 command.c:145 script_debug(): command - ocd_target ocd_target init
Debug: 27 34 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target names
Debug: 28 34 command.c:145 script_debug(): command - ocd_target ocd_target names
Debug: 29 34 target.c:1313 handle_target_init_command(): Initializing targets...
Error: 30 35 core.c:1331 adapter_init(): Debug Adapter has to be specified, see "interface" command
Debug: 31 35 command.c:628 run_command(): Command failed with error code -101
User : 32 35 command.c:689 command_run_line(): embedded:startup.tcl:60: Error:
in procedure 'script'
at file "embedded:startup.tcl", line 60


do you see any problem ?

anis19

when i run : openocd -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f board/crossbow_tech_imote2.cfg
i get this output :
Open On-Chip Debugger 0.9.0 (2016-04-11-10:37)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
adapter speed: 6000 kHz
adapter_nsrst_delay: 260
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
jtag_ntrst_delay: 250
Info : imote2.cpu: hardware has 2 breakpoints and 2 watchpoints
adapter_nsrst_delay: 800
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
Info : clock speed 6000 kHz
Info : JTAG tap: imote2.cpu tap/device found: 0x79265013 (mfg: 0x009, part: 0x9265, ver: 0x7)

everything freeze and the light of the ARM-USB-TINY-H turn off and the light of my target device start blinking and changing colors. I guess this mean that the communication with the target device is okey. isn't it ?

LubOlimex

The output seems alright. Now open a terminal program and start a telnet session with address 192.168.0.1 and port 4444. You can send commands to the board via the telnet. Try with "reset halt" and read the documentation of OpenOCD for more info about the available commands.

If you face any problems:

1) Try lowering the adapter speed (which is written somewhere in the cfg files) to 1000 or 2000. The value 6000 might be a bit high.

2) Try to set the reset strategy manually in one of the cfg files - try with "reset_config srst_only srst_pulls_trst"

Best regards,
Lub/OLIMEX

Technical support and documentation manager at Olimex

anis19

thank you for the answer.
i made a telnet connexion with : telnet 127.0.0.1 4444 (i couldn't with 192.168.0.1)
i taped 'reset halt' and i got this output :
Info : accepting 'telnet' connection on tcp/4444
Info : JTAG tap: imote2.cpu tap/device found: 0x79265013 (mfg: 0x009, part: 0x9265, ver: 0x7)
Warn : Bad value '00' captured during DR or IR scan:
Warn :  check_value: 0x02
Warn :  check_mask: 0x07
Error: JTAG error while writing DCSR
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x480000d3 pc: 0x00000000
MMU: disabled, D-Cache: disabled, I-Cache: disabled
(processor reset)

i tried to put the program on the device again and i got the same problem (stopping at Starting openOCD ...)
Then i changed the adapter speed to 1000 and i tried to put the program and it stops at the same point.
I am not sur about where to put the reset strategy you suggested in your 2) do you still believe it may change something ?
I am sorry if some of my questions may be from a very bad level, i am not used to all of that.

Thanks again.

LubOlimex

Hey,

The interesting part is that despite the warnings and the error the "reset halt" command seems to complete successfully. The basic commands seems to work fine. So I must conclude that the connection between the target, the board and the debugger are all fine. I recommend you to try to flash your by executing the OpenOCD commands manually via the telnet connection.

I is pretty obvious that the problem is in this line:

>> sudo make intelmote2 install openocd

Unfortunately, I don't know what intelmote2 but your source information might be misleading. A quick search in the Internet for using OpenOCD + iMote2 + ARM-USB-TINY (note the no H version) doesn't have a line like that:

http://tinyos.stanford.edu/tinyos-wiki/index.php/OpenOCD_for_IMote2

I also recommend you ask kindly in the OpenOCD mailist or in tinyos community. They might have better answers.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

anis19

Thank You :) i finally found a solution in a forum of intelmote2, i had to change the configuration file because it was using ARM-USB-TINY and not ARM-USB-TINY-H. i thought it was the same configuration but actually not.
Thanks again.
the solultion have been found here : https://groups.yahoo.com/neo/groups/intel-mote2-community/conversations/topics/3928
i believe it might help somebody someday.