November 07, 2024, 07:42:59 PM

Example binary for SAM3-H256?

Started by nightonearth, June 22, 2016, 03:11:36 PM

Previous topic - Next topic

nightonearth

Hello everyone,

I am trying to get started with a SAM3-H256 board. My toolchain is OpenSUSE 13.2, Codeblocks 13.12, gcc-arm-none-eabi-5_3-2016q1 and I program the device with an OpenOCD JTAG ARM-USB-OCD-H (openOCD 0.8.0).

So far I can generate code, compile it, convert .elf to .bin and write and verify with openocd. But no example has any effect on the device. Not even the simple LED blinking example (PIN_PA8 remains constant at 1.8V, all others at 3.3V)

As there are plenty of possible reasons I would first like to test if my programming procedure works correctly. Thus it would be very helpful to have a compiled example binary that provenly works on another SAM3-H256 board.

Would anyone be able to provide such a binary?


Best regards

Jesco

JohnS

Looks to be one in the demo code on the product page.

You may need the TST jumper.

John

nightonearth

Hello John,

thanks for your quick reply. Actually I have tried to use this example before. Now I checked it once more by using the script below. The output is below as well. It looks to me as if the binary was written correctly to flash. But the LED is not blinking and the described mouse actions are not visible. There is no difference when I set / remove the TEST-jumper.

Has anyone a hint, what is still going wrong?


Best regards

Jesco

----------------------------------------------------------------------
openOCD-Script:

telnet_port 4444
gdb_port 3333

source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]

source [find target/at91sam3sXX.cfg]

scan_chain
flash banks
reset_config
init
reset halt
at91sam3 gpnvm show all
flash probe 0

program SAM3-Hxxx_demo.bin verify 0x00400000

shutdown

------------------------------------------------------------------------
Output:

sam3-h256/002-demo> openocd -f openocd-neu.cfg
Open On-Chip Debugger 0.8.0 (2014-10-07-01:33)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
cortex_m reset_config sysresetreq
   TapName             Enabled  IdCode     Expected   IrLen IrCap IrMask
-- ------------------- -------- ---------- ---------- ----- ----- ------
0 sam3.cpu               Y     0x00000000 0x4ba00477     4 0x01  0x0f
#0 : sam3.flash (at91sam3) at 0x00400000, size 0x00000000, buswidth 1, chipwidth 1
none separate
Info : clock speed 500 kHz
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : sam3.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: sam3.cpu -- clearing lockup after double fault
Polling target sam3.cpu failed, GDB will be halted. Polling again in 100ms
Polling target sam3.cpu succeeded again
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
sam3-gpnvm0: 0
sam3-gpnvm1: 0
flash 'at91sam3' found at 0x00400000
Info : JTAG tap: sam3.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
auto erase enabled
Info : sam3 auto-erases while programming (request ignored)
wrote 16384 bytes from file SAM3-Hxxx_demo.bin in 2.280169s (7.017 KiB/s)
** Programming Finished **
** Verify Started **
verified 15540 bytes in 0.817376s (18.566 KiB/s)
** Verified OK **
shutdown command invoked
shutdown command invoked


LubOlimex

Hey,

Is the device listed in "Windows Device Manager"? Did you install the drivers from the archive with the demo (*.inf files in the sub-folders of \libraries\usb\device)?

Some of the demos that we have require pressing the button to continue with the next demo (e.g. first test LED, when done press user button to start the second test, etc.).

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

nightonearth

Hello Lub,

I used SAM3-H256_demo_v1.0_03-May-2011.zip, which I downloaded from

https://www.olimex.com/Products/ARM/Atmel/SAM3-H256/

(Software demo code).

I am running opensuse 13.2 on a virtual machine under which I execute the described actions. The host OS is Win7 Professional. When I connect the SAM3-H256 via USB to the computer it is recognized by the linux system. I can see

crw-rw---- 1 root dialout 166, 0 23. Jun 11:18 /dev/ttyACM0

This is the case when I have removed the TEST-jumper. With the TEST-jumper on the board is not recognized.

On the host OS the device is automatically recognized as "Bossa Program Port (COM4)". When I try to replace the driver with the mentioned "CompositeCDCSerial.inf" or "6119.inf" Win7 tells me that no compatible drivers are available in the directory (I must admit I am not too experienced with driver installation on windows).

But still the LED is not blinking which I would expect even if the device is not recognized propperly.

Do you have any further hints?


Best regards

Jesco

LubOlimex

Please test with one of the binaries from this archive (they should blink the LED): https://drive.google.com/file/d/0BwplT87k9SCgWDNkUXNGWE0wQms/view?usp=sharing

Also test if the bootloader is still intact - the board has bootloader by default and can be programmed via the USB using SAM-BA software. If the bootloader is still working try to upload the code via it (if it works it would prove that there are errors in your OpenOCD script).

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

nightonearth

Hello Lub,

GREAT! Thanks a lot. Now SAM-BA 2.16 on windows 7 worked for me.

So I have to find the bug in my openOCD script.

Thanks once again.


Best regards

Jesco

nightonearth

Hello everyone,

for those, who are interested in programming the SAM3-H256 with the described setup:


myconfig.cfg start
############################
telnet_port 4444
gdb_port 3333

source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]

source [find target/at91sam3sXX.cfg]

scan_chain
flash banks
reset_config
init
reset halt
at91sam3 gpnvm show all
flash probe 0

program SAM3_read_simple.bin verify 0x400000

shutdown
#####################
myconfig.cfg end


openocd -f myconfig.cfg


does the job for me now. The first time I tried it this way it did not work. Then I programmed the device using SAM-BA and finally executed the script "Boot from Flash (GPNVM1)". I think this is what finally made it work, although I don't really have an idea what the script did.

After that programming with openOCD worked as well.


Best regards

Jesco

nightonearth

Hello everyone,

OK - the final answer is that my GPNVM bit 1 was set to 0 (="Boot from RAM") setting it to 1 (="Boot from Flash") ceartainly works better.

So the openOCD config script looks like this:

###################
telnet_port 4444
gdb_port 3333

source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]

source [find target/at91sam3sXX.cfg]

scan_chain
flash banks
reset_config
init
reset halt

# This is new:
at91sam3 gpnvm set 1
#

at91sam3 gpnvm show all
flash probe 0

program SAM3_read_simple.bin verify 0x400000

shutdown
##############


Best regards

Jesco