chipKIT uC32 with Dragino YUN shield

Post Reply
ltheoret
Posts: 50
Joined: Wed Dec 23, 2015 9:19 pm

chipKIT uC32 with Dragino YUN shield

Post by ltheoret » Sun Feb 21, 2016 6:39 am

Hi,

I have been working with the chipKit family of board since about the start of Dec 2015. I have 2) uC32, 1) WF32 and 1) WiFire. I have been working a lot with the WF32 developing a web server, This seemed counter productive as that is not my cup of tea. (I also have 4- Infiduino wich are Arduino Uno R3 clones for testing new hardware).
I both a Dargino YUN shield. This was to test with the uC32. Well the good news is that the bridge seams to be working with it so far. I can read and control the chipkit from the YUN shield. Now to do my homework, to see if I can program the chipkit through the YUN shield.

Currently to program the chipkit I have to remove the YUN shield from the board, program it using USB then plug the shield back in.
I have a Leonardo and a DUE on order. the Leonardo was a mistake oops. Since the bridge works with the chipkit with no modifications the DUE was a mistake too. Dragino YUN shield manual says the DUE is not compatible with the bridge.

Luc

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: chipKIT uC32 with Dragino YUN shield

Post by majenko » Sun Feb 21, 2016 12:44 pm

Nice board. I wasn't aware that existed. I have just ordered one from Swizerland - probably take a while to get to me, but that's the closest I could find...

It should be perfectly possible to program the chipKIT from the OpenWRT side of things. The two main problems are auto-resetting the board, which can probably be done through a GPIO the same as Arduino boards, and running pic32prog or avrdude to do the programming. That latter is the hardest point...

We do not have a precompiled MIPS Linux binary of pic32prog as yet, and the newer versions (6+) versions of avrdude cannot cope with the pic32 address range. So cross-compiling pic32prog using the OpenWRT cross-compiling tools will be needed. That is something I will be tackling when my Yun shield arrives, but I can start looking with my normal Yun before then.

Once that has all been tackled you can use UECIDE to remote program in just the same way as the Yun or chipKIT Pi, through SSH. There are Pi scripts that can be adapted here: https://github.com/UECIDE/ckpi-support

Sent from my SM-T555 using Tapatalk
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: chipKIT uC32 with Dragino YUN shield

Post by majenko » Sun Feb 21, 2016 8:39 pm

I have started building the OpenWRT "buildroot" system (cross compiler environment) for the Yun. It may take a while... Once that is done I will look at building pic32prog with it.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

nroff-man
Posts: 40
Joined: Wed Oct 01, 2014 6:05 pm

Re: chipKIT uC32 with Dragino YUN shield

Post by nroff-man » Sun Feb 21, 2016 10:25 pm

Hi

My pic programmer for all PICMicros which includes the PIC32 has been
working well on OpenWRT for some years already.

See this page (for an example of how to do this):
http://wiki.kewl.org/dokuwiki/boards:wr841nd

The STK500v2 compatible loader tool named `pload' should also work and
will program via a serial interface. USB serial has not been tested on
OpenWRT though.

Bye

ltheoret
Posts: 50
Joined: Wed Dec 23, 2015 9:19 pm

Re: chipKIT uC32 with Dragino YUN shield

Post by ltheoret » Sun Feb 21, 2016 11:34 pm

Hi,

To get the YUN shield to program all they did was include the file attached to the:
Arduino/hardware/Arduino/avr/board.txt
Attachments
boards.txt
Included board definition file.
(3.03 KiB) Downloaded 18 times

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: chipKIT uC32 with Dragino YUN shield

Post by majenko » Sun Feb 21, 2016 11:47 pm

Yeah, but it programs Arduino boards through the ICSP header directly, with no bootloader installed. That can't be done with chipKIT boards, since the ICSP header isn't, and avrdude wouldn't be able to work with it anyway if it was.

The programming has to happen through the serial port using the bootloader and the proper pic32 tools - i.e., pic32prog or something similar. And that means compiling those tools for the right architecture. And that is proving somewhat arduous at the moment as I have just found that I have compiled my OpenWRT environment for the wrong libc - they seem to have changed from uClibc to musl as the default :( I don't know what version the Yun shield you have uses, but my Yun use uClibc.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

nroff-man
Posts: 40
Joined: Wed Oct 01, 2014 6:05 pm

Re: chipKIT uC32 with Dragino YUN shield

Post by nroff-man » Mon Feb 22, 2016 12:09 am

lo

the easiest way to create a cross compiler is to build
an image for openwrt.

for example, for my wr841 which was built in jan:

root@wr841:/usr/bin# uname -a
Linux wr841 4.1.15 #3 Tue Jan 19 13:15:06 GMT 2016 mips GNU/Linux

root@wr841:/usr/bin# ldd pload
/lib/ld-musl-mips-sf.so.1 (0x5570a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x77a6a000)
libc.so => /lib/ld-musl-mips-sf.so.1 (0x5570a000)

i can cross compile from Linux using a custom make file utilising the tool
chain used to make the firmware.

Eg.
export STAGING_DIR = /embedded/openwrt/openwrt.git/staging_dir
COMPILE = $(STAGING_DIR)/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/bin/mips-openwrt-linux-
AS = $(COMPILE)as
LD = $(COMPILE)ld
CC = $(COMPILE)gcc

This PIC18 boot loader project:
http://hg.kewl.org/pub/wellington/
contains a subdir called `loader' where i build a binary for the router and run
it via an NFS mount.

This should be enough information.

bye

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: chipKIT uC32 with Dragino YUN shield

Post by majenko » Mon Feb 22, 2016 12:25 am

Yeah, I know, and that is exactly what I am doing. Except thanks to OpenWRT what I had spent the afternoon compiling is no good.

I also have a separate toolchain (mips-linux-uclibc) which I know will create the right binaries for me, except I can't get it to compile the pre-requisite libraries that I need to get libusb and libusb-1.0 to compile so I can then compile pic32prog.

Well, OpenWRT thinks it's compiling "toolchain-mips_34kc_gcc-5.2.0_uClibc-1.1.12" at the moment, which if it succeeds (it failed just now with infinite symbolic link depth errors) it might finally allow me to compile the libraries I need...
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

nroff-man
Posts: 40
Joined: Wed Oct 01, 2014 6:05 pm

Re: chipKIT uC32 with Dragino YUN shield

Post by nroff-man » Mon Feb 22, 2016 12:38 am

lo

why do you even need libusb?

i don't know much about the uC32 but it looks like an FTDI which should
be ttyUSB or whatever in Linux.

the solution to this already exists using the `pload' shown in the previous
posts.

bye

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: chipKIT uC32 with Dragino YUN shield

Post by majenko » Mon Feb 22, 2016 12:58 am

libusb is required by pic32prog. pic32prog is the tool that we use.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply