New to ChipKIT Pi

sethkush
Posts: 9
Joined: Thu Mar 05, 2015 5:58 am

New to ChipKIT Pi

Post by sethkush » Thu Mar 05, 2015 6:08 am

I got a used chip kit pi from a friend, and I'm having a bit of trouble getting started. I can't program it by USB, I've installed all the driver software, and neither Windows, OS X, or Linux senses a serial port (lsusb and its alternatives show nothing). Is there any way to fix this?

I could program it from the Pi with avrdude through /dev/ttyAMA0 (I don't have X.org, so an IDE is out of the question). How do I get a hex file, and what arguments should I use to upload it through the Pi's serial port?

Thanks.

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

Re: New to ChipKIT Pi

Post by nroff-man » Thu Mar 05, 2015 9:31 pm

Hi
sethkush wrote:I got a used chip kit pi from a friend, and I'm having a bit of trouble getting started. I can't program it by USB, I've installed all the driver software, and neither Windows, OS X, or Linux senses a serial port (lsusb and its alternatives show nothing). Is there any way to fix this?
The boot loader can only be for the UART or USB but not both simultaneously.

If you have the board attached to an RPi, then you only need the UART boot loader
which is the one you have already.

You can reprogram the chip with a USB boot loader if you don't want to use the
RPi.
I could program it from the Pi with avrdude through /dev/ttyAMA0 (I don't have X.org, so an IDE is out of the question). How do I get a hex file, and what arguments should I use to upload it through the Pi's serial port?

Thanks.
Getting a hex file really depends on how you want to write programs for the board.

I don't use MPIDE so cannot advise if this is what you want to achieve.

Bye-bye

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

Re: New to ChipKIT Pi

Post by majenko » Thu Mar 05, 2015 9:32 pm

I have been doing some work today on improving the command line interface to UECIDE. You can install that into the Pi and use that to do all your compilation and uploading from the command line. Be sure to install the beta version to get the best command line experience. Run uecide --help to see all the available options.

I'm going to document all the settings and how to compile and install packages when I get back to my computer shortly.
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: New to ChipKIT Pi

Post by majenko » Fri Mar 06, 2015 12:53 am

Ok.. I just fixed a small bug in UECIDE's ARM repository handling, so now Pi command line usage works properly.

Anything from 0.8.8alpha6 onwards can be used completely from the command line on a Pi.

It's best to install from the apt repository. As root, edit the file /etc/apt/sources.list and add the line:

Code: Select all

deb http://dist.majenko.co.uk/ unstable main contrib beta
Then install the respository key:

Code: Select all

$ wget -O - http://dist.majenko.co.uk/autobuild.key | sudo apt-key add -
Then update and install UECIDE:

Code: Select all

$ sudo apt-get update
$ sudo apt-get install uecide
Now you're ready to rumble with UECIDE. First job is to install the chipKIT Pi and its support files:

Code: Select all

$ uecide --update
Making apt folder
Making db folder
Making sources file
1 sources
>>> http://repo.uecide.org/uecide libraries plugins extra compilers cores boards
http://repo.uecide.org/uecide/dists/uecide/libraries/binary-linux-armhf/Packages.gz
http://repo.uecide.org/uecide/dists/uecide/plugins/binary-linux-armhf/Packages.gz
http://repo.uecide.org/uecide/dists/uecide/extra/binary-linux-armhf/Packages.gz
http://repo.uecide.org/uecide/dists/uecide/compilers/binary-linux-armhf/Packages.gz
http://repo.uecide.org/uecide/dists/uecide/cores/binary-linux-armhf/Packages.gz
http://repo.uecide.org/uecide/dists/uecide/boards/binary-linux-armhf/Packages.gz
$ uecide --install=chipkit-pi
Installing chipkit-pi...++++...done.
It takes a while - the compiler is pretty damn huge (hundreds of MB, so make sure you have plenty of room on your SD card...)
Now you're ready to compile... Let's compile "Blink" and upload it to the cKPi...

Code: Select all

$ uecide --board=chipkit-pi --port=/dev/ttyAMA0 --upload --compile .uecide/cores/chipkit/examples/1.Basics/Blink/
Compiling...
============
    * Compiling sketch...
    * Compiling core...
      > api
    * Compiling libraries...
    * Linking sketch...
Compiling done.
===============
Memory usage
============
    * Program size: 6272 bytes
    * Memory size: 368 bytes
    * Compilation took 39.729 seconds
Uploading firmware...
=====================
At this point on mine it cuts off as I don't have a cKPi connected at the moment - but it would attempt to upload the sketch then - so make sure the cKPi is in programming mode and you have access to the serial port (you're in the dialout group).

There's lots more in UECIDE's internal repository - loads of libraries, other boards, etc. You can use "uecide --search=<term>" to find things to install, then install them with "uecide --install=<package name>".

You can run "uecide --help" to see the full list of commands you can 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".

sethkush
Posts: 9
Joined: Thu Mar 05, 2015 5:58 am

Re: New to ChipKIT Pi

Post by sethkush » Fri Mar 06, 2015 5:29 am

I don't use Debian, is there a source tar ball available for the IDE, or will I have to extract the binaries, etc. from the .deb package?

EDIT: I found the linux zip, everything seems to be working. I will update when I get to the actual compiling and transferring part. Thanks for the help.

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

Re: New to ChipKIT Pi

Post by majenko » Fri Mar 06, 2015 10:58 am

What are you running on your Pi then? I should really look into the packaging systems of other distros and maybe provide the packages for them as well...
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".

sethkush
Posts: 9
Joined: Thu Mar 05, 2015 5:58 am

Re: New to ChipKIT Pi

Post by sethkush » Sat Mar 07, 2015 5:48 am

I use Slackware-arm 14.1. I wouldn't worry about a Slackware package if I were you; an RPM might get some use though.

Just a note, it might be nice to have the option to store the IDE files in a more 'System-wide' directory, like /usr/bin. rather than have each user install all the compilers in their home directories.

The compilers it downloads also use /lib/ld-linux-armhf.so.3 as an interpreter; many systems only include /lib/ld-linux.so.3 either changing the compiler binaries or creating a symlink will fix this issue.

sethkush
Posts: 9
Joined: Thu Mar 05, 2015 5:58 am

Re: New to ChipKIT Pi

Post by sethkush » Sat Mar 07, 2015 7:13 am

I'm able to compile now, but avrdude is throwing an error:

Code: Select all

Uploading firmware...
=====================
    * Resetting board...
    * Uploading...
avrdude: error at line 620 of /home/seth/.uecide/cores/chipkit/tools/linux_arm/avrdude.conf: pin must be in the range 1-17
    * Resetting board...
Upload Failed
Here is that area of the file:

Code: Select all

programmer
  id    = "ponyser";
  desc  = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts";
  type  = serbb;
  reset = ~3;        <----- line 620
  sck   = 7;
  mosi  = 4;
  miso  = 8;
;

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

Re: New to ChipKIT Pi

Post by nroff-man » Sat Mar 07, 2015 8:33 am

hi.

pony serial is an adapter for RS232 AVR ISP and not used
for uploading to the boot loader on the chipKIT Pi.

the avrdude command should be something like this:

Code: Select all

avrdude -v -v -P /dev/ttyAMA0 -b 115200 -p pic32-250-128 -c stk500v2 -U flash:w:FILE.HEX
Bye

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

Re: New to ChipKIT Pi

Post by majenko » Sat Mar 07, 2015 11:15 am

Looks like there's an error in the avrdude.conf file there... It's poorly maintained and has lots of cruft in it. In my opinion there is no need for anything except the PIC32 stuff in there - all the AVR hardware programmers can be deleted.

Just delete that programmer section and try again. Alternatively you can try (untested as yet on ARM) pic32prog. Add the flag

Code: Select all

--programmer=pic32prog
to your command line. We're eventually going to be switching away from avrdude to use pic32prog.
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