mattairtech / ArduinoCore-samd

This is a fork from arduino/ArduinoCore-samd on GitHub. This will be used to maintain Arduino support for SAM D|L|C (M0+ and M4F) boards including the MattairTech Xeno Mini and the MT-D21E (see https://www.mattairtech.com/). It adds support for new devices like the D51, L21, C21, and D11. It also adds new clock sources, like a high speed crystal or internal oscillator.
103 stars 43 forks source link

Problem uploading sketch #27

Open obdevel opened 5 years ago

obdevel commented 5 years ago

I have an own-design board based on the ATSAMC21G18A Xeno mini but with CAN bus and other devices. I have a J-link programmer and can successfully compile, run and debug using AS7.

I have also programmed the sam_ba_Generic_x21G_SAMC21G18A.bin bootloader onto the board using this environment.

Using Arduino (1.8.8 on macOS) I can compile sketches but I can't upload to the board using a USB/serial adaptor on the RX1 and TX1 pins. Error is:

Uploading using selected port: /dev/cu.SLAB_USBtoUART
/Users/xyz/Library/Arduino15/packages/MattairTech_Arduino/tools/bossac/1.7.0-mattairtech-3/bossac -i -d --port=cu.SLAB_USBtoUART -U true -i -e -w -v /var/folders/03/s3pv8qk91w78m4_st_nbxl5m0000gn/T/arduino_build_445384/ATSAMC21G18A_test_v1.ino.bin -R 
No device found on cu.SLAB_USBtoUART
Set binary mode
Send auto-baud
Set binary mode
An error occurred while uploading the sketch

I'm using the latest board version 1.6.18-beta-b1.

I've tried exporting the compiled binary (.bin) for a simple blink sketch and programming it using AS7; this appears to work but there is no output (LEDs, serial, etc) so I doubt that it is running.

What do you suggest I try next ?

fwiw, another board, based on ATSAMD11D14A, works just fine with this core and bootloader.

Thanks.

obdevel commented 5 years ago

An update on progress, such as it is. I can now run sketches by exporting the compiled binary and programming externally using OpenOCD 0.10.0. Serial1-3, Wire and CAN work as expected.

Here's a screen grab of my config:

screen shot 2019-03-03 at 20 55 32

My openocd.cfg : (cobbled together from various sources)

source [find interface/jlink.cfg]
transport select swd

set CHIPNAME at91samc21g18
source [find target/at91samdXX.cfg]

reset_config  srst_nogate
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

init
targets
reset halt
at91samd bootloader 0
program ATSAMC21_CAN_v1.ino.Xeno_Mini.bin verify
reset
shutdown