Mechaduino servo - group-build?

Sounds like we’re going to have a group build night this Wednesday. Anytime from late afternoon to evening.

I got one of mine working pretty well, except I suspect I blew one channel of the MOSFET stepper driver, so the stepper limps on every second step. Incredibly, the software calibration works around this somewhat.

1 Like

Hey @LoialOtter . I was just looking for the programmer as was thinking to program a few mechaduinos tonight. The J-Link is no longer in the locker with the kits. I gather that you have taken it back? Any chance that we could use it again in the next little while?

Mark

1 Like

Mark, I have one to loan if you need it.

2 Likes

Sorry, ya, had to grab it back this last week.

@lukecyca
Thanks! Almost forgot that. So I just let you know the day I’m going to grab it?

We’re going to do another build night on Thursday, Dec 1. I’ll be there from 5pm onward (but have to teach a laser training at 7pm).

I have one unit built and working well, so everyone’s welcome to have a look and try it out. I’ll be building my second one.

@Jarrett and @Janet will be there.

If you have yet to build yours, or even pick up your kit. THEN YOU SHOULD COME!

If you didn’t get a kit but would like to come and see what it’s all about, you’re more than welcome.

3 Likes

Sweet, will be there!

2 Likes

I managed to get the Mechaduino boot loader programmed with a JLink Segger and OpenOCD

Installation of OpenOCD is beyond the scope of this post. Ping me if you have any questions and I’ll do my best to help

Steps to get this working

  1. Connect the JLink Segger to the Mechaduino board using the 10 pin unpopulated SWD connector.
    This is easy to do with just a press fit as I did not solder the male SWD jumper to the board. This step only needs to be done once.

Note pin 1 is the side that is away from the micro USB connector. This Matches the red side of the cable

  1. Connect the Micro USB cable to the Mechaduino.

  2. Plug in the Mechaduino USB cable to your computer. The Mechaduino must be powered.

  3. Plug in the JLink USB cable to your computer

You will need to apply a little bit of angled pressure to the connection to get good electrical contact.


I ran openocd From the command line and passed it a configuration file called mechtest.cfg

→ openocd -f mechtest.cfg

The contents of the configuration file mechtest.cfg were as follows.

source [find interface/jlink.cfg]
transport select swd
set CHIPNAME at91samd21g18
source [find target/at91samdXX.cfg]

reset_config srst_gates_jtag

adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

init
targets
reset halt

at91samd chip-erase

program samd21_sam_ba.bin exit 0x00000000 verify
reset


On success you should see output resembling the folllowing

openocd -f mechtest.cfg
Open On-Chip Debugger 0.9.0 (2015-11-15-05:34)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Info : JLink SWD mode enabled
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
none separate
adapter_nsrst_delay: 100
adapter_nsrst_assert_width: 100
Info : J-Link V9 compiled Jun 23 2015 10:00:59
Info : J-Link caps 0xb9ff7bbf
Info : J-Link hw version 93000
Info : J-Link hw type J-Link
Info : J-Link max mem block 70912
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0xffffffff
Info : Vref = 3.322 TCK = 0 TDI = 0 TDO = 0 TMS = 0 SRST = 1 TRST = 1
Info : J-Link JTAG Interface ready
Info : clock speed 500 kHz
Info : SWD IDCODE 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints
Error: at91samd21g18.cpu – clearing lockup after double fault
Polling target at91samd21g18.cpu failed, trying to reexamine
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints
TargetName Type Endian TapName State


0* at91samd21g18.cpu cortex_m little at91samd21g18.cpu halted
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0xfffffffe msp: 0xfffffffc
chip erased
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21G18A (256KB Flash, 32KB RAM)
wrote 16384 bytes from file samd21_sam_ba.bin in 2.153932s (7.428 KiB/s)
** Programming Finished **
** Verify Started **
verified 5972 bytes in 0.511491s (11.402 KiB/s)
** Verified OK **
shutdown command invoked

There are other ways and tools to program boot loaders. I am no expert but this is what I managed to get working.

Thanks to @LoialOtter for the initial scripts and @TomKeddie for his loan of the JLink Segger for a week or so.

2 Likes

Tonight was great. Thanks Mark and Luke for keeping this project rolling.
I’m uploading the firmware as we speak. Wooo!

3 Likes

FYI this is the EDU model of the segger. It’s a more affordable genuine unit for non commercial use. Still not cheap at $US60.

http://www.mouser.com/ProductDetail/Segger-Microcontroller/J-Link-EDU/

The fake $US15 jlink units from China are usually rendered unusable by the driver (although there are ways around this).

2 Likes

I think we should buy one of these for the space. There are enough of us programming chips that it’s handy to have.

Could you please re-upload this pdf -top.pdf, -bottom.pdf? Site reports it’s missing… ((

Mechaduino-bottom.pdf (120.1 KB)
Mechaduino-top.pdf (661.4 KB)

1 Like

I got this message on both files: Oops! That page doesn’t exist or is private.
Can u help me to obtain It?

Sorry, the server gophers are currently updating all the links… let me see if i can put it online elsewhere for the moment!

you can put it to my email :slight_smile: undef@inbox.ru. Thanks in advance!

Mechaduino-bottom.pdf (120.1 KB)
Mechaduino-top.pdf (661.4 KB)

thank u very much

Just wanted to document the process to burn a boot loader to a Mechaduino using a Black Magic Probe from 1Bitsy.

"The bmp is a JTAG and SWD Adapter used for programming and debugging ARM Cortex MCUs. Its the best friend of any ARM microcontroller developer.

Black Magic Probe gets rid of intermediate programs like OpenOCD or STLink server. This makes the operation faster and more reliable. You just open your GNU Debugger (GDB) and select the virtual com port offered by BMPM2 as your extended remote target."

My assumptions are that you have already installed the bmp and set up your arm-none-eabi-gdb toolchain. The ARM Toolchain setup is outside the scope of this post but there is lots of info available online.

Here is a handy youtube video tutorial on Setting up the BMP if you need some help with that.

Essentially you are connecting the bmp to your computer via with USB micro cable and then connecting the bmp to the Mechaduino with a 10pin .05 pitch ribbon cable. On the Mechaduino note that the orientation of pin one (the red side) points to the top of the board away from the USB micro connector. There are some male connectors at VHS if you need to solder these to your board. See the following pic.

You do not need to power your Mechaduino as the bmp supplies the voltage.

So once your connections are made you should grab a copy of the samd21_sam_ba.hex boot loader from github and drop this in some directory.

Next up is to fire up your debugger and pass it the name of the boot loader hex file.
You will be typing the line after ‘==============’

==============================================
MJs-Air-Ride:~/Documents/VHS/MechaduinoStuff/bootloader$ arm-none-eabi-gdb samd21_sam_ba.hex

GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20160616-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “–host=x86_64-apple-darwin10 --target=arm-none-eabi”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from samd21_sam_ba.hex…(no debugging symbols found)…done.

==============================================
(gdb) target extended-remote /dev/cu.usbmodem7BAD8791 (You will need to determine your port id)

Remote debugging using /dev/cu.usbmodem7BAD8791

==============================================
(gdb) monitor tpwr enable (allow the BMP to supply voltage to your board)

==============================================
(gdb) monitor swdp_scan (look for swp targets)

Target voltage: 3.3V
Available Targets:
No. Att Driver
1 Atmel SAMD21G18A (rev D)

==============================================
(gdb) attach 1 (attach to the first target)

Attaching to program: /Users/majicj/Documents/VHS/MechaduinoStuff/bootloader/samd21_sam_ba.hex, Remote target
0x00005294 in ?? ()

==============================================
(gdb) monitor erase_mass (erase everything - don’t have to do this if you don’t want to)

Erase successful!

==============================================
(gdb) load (burn the hex file to the flash)

Loading section .sec1, size 0x1968 lma 0x0
Start address 0x614, load size 6504
Transfer rate: 18 KB/sec, 929 bytes/write.

==============================================
(gdb) compare-sections (compare the flash to your file. These should match if everything went well)

Section .sec1, range 0x0 – 0x1968: matched.

That’s it you have now burned a boot loader. You should be able to program your Mechaduino using your Arduino IDE as you normally would.

There is a ton of more stuff that you can do with the debugger but that a topic for another post.

Mark

3 Likes

Hi All,

I am putting together 10 Mechaduino V2’s (including uploading bootloader for Arduino IDE) and I will probably have 5 or six left over. Who would be interested in buying these? I will only be covering costs and buyer pays shipping from Denmark. First come first serve.

Let me know.

Dylan