Welcome! Log In Create A New Profile

Advanced

Firmware on the 16f648

Posted by sai 
sai
Firmware on the 16f648
July 23, 2007 04:45AM
There is some [very] preliminary code in subversion for building with
new versions of sdcc and for the 16f648a.

It is in subversion at
/reprap/branches/autoconf-firmware

In order to build this, you need to have a very recent version of
gputils. To determine if you have a recent enough version, run the
command "gpasm -v". You should see "gpasm-0.13.4 beta" or higher
(actually there is currently nothing higher, but no doubt there could be
soon).

To build an appropriate version of gputils, you need to check it out
from CVS.

You should also build sdcc from subversion.

When you install sdcc, make sure it's pointing to your newly compiled
gpasm and gplink, not some old copies. You can verify which instance of
gpasm sdcc is using by compiling something with -V. Or, if you're
unsure how to do that, do something like this to print the gpasm path
that sdcc is using (all one line):

echo "void main(){}" > tmp.c && sdcc -V -c tmp.c | grep gpasm | sed
's/^\+ "\([^"]*\)".*$/\1/' && rm tmp.c

The firmware is configured with autoconf, so to build it you do the
normal gnuey thing:
./configure
make

Here's a complete command-by-command walkthrough for building everything
current. This can be executed by a normal user (no root privileges
required).

1. Build gputils
mkdir $HOME/reprap-tools
cd $HOME/reprap-tools
cvs -d:pserver:anonymous@gputils.cvs.sourceforge.net:/cvsroot/gputils login
(just press enter when prompted for a password)
cvs -z3
-d:pserver:anonymous@gputils.cvs.sourceforge.net:/cvsroot/gputils co -P
gputils
cd gputils
./configure --prefix=$HOME/reprap-tools
make
make install

2. Build sdcc
cd $HOME/reprap-tools
svn co [sdcc.svn.sourceforge.net]
cd sdcc
./configure --prefix=$HOME/reprap-tools --disable-mcs51-port
--disable-gbz80-port --disable-z80-port --disable-avr-port
--disable-ds390-port --disable-ds400-port --disable-xa51-port
--disable-hc08-port --disable-ucsim
make
make install

3. Build reprap firmware
mkdir $HOME/reprap
cd $HOME/reprap
svn co
[reprap.svn.sourceforge.net]
cd autoconf-firmware
PATH=$HOME/reprap-tools/bin:$PATH
./configure
make

The output files will be located in
~/reprap/autoconf-firmware/devices/stepmotor/stepmotorx.hex
~/reprap/autoconf-firmware/devices/stepmotor/stepmotory.hex
~/reprap/autoconf-firmware/devices/stepmotor/stepmotorz.hex
~/reprap/autoconf-firmware/devices/extruder_0/extruder0.hex
~/reprap/autoconf-firmware/devices/extruder_1/extruder1.hex
etc...

_______________________________________________
Developers mailing list
Developers@reprap.org
[reprap.org]
sai
Re: Firmware on the 16f648
July 23, 2007 04:54AM
I probably should put this on something that isn't affected by word wrapping, but try this instead. Again, just press enter when prompted for the CVS login password.

1. Build gputils
mkdir $HOME/reprap-tools
cd $HOME/reprap-tools
cvs \
  -d:pserver:anonymous@gputils.cvs.sourceforge.net:/cvsroot/gputils \
  login
cvs -z3 \
  -d:pserver:anonymous@gputils.cvs.sourceforge.net:/cvsroot/gputils \
  co -P gputils
cd gputils
./configure --prefix=$HOME/reprap-tools
make
make install

2. Build sdcc
cd $HOME/reprap-tools
svn co https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc
cd sdcc
./configure --prefix=$HOME/reprap-tools --disable-mcs51-port \
  --disable-gbz80-port --disable-z80-port --disable-avr-port \
  --disable-ds390-port --disable-ds400-port --disable-xa51-port \
  --disable-hc08-port --disable-ucsim
make
make install

3. Build reprap firmware
mkdir $HOME/reprap
cd $HOME/reprap
svn co \
  https://reprap.svn.sourceforge.net/svnroot/reprap/branches/autoconf-firmware
cd autoconf-firmware
PATH=$HOME/reprap-tools/bin:$PATH
./configure
make

_______________________________________________
Developers mailing list
Developers@reprap.org
[reprap.org]

Edited 3 time(s). Last edit at 07/23/2007 05:25AM by Simon McAuliffe.
sai
Re: Firmware on the 16f648
July 23, 2007 04:58AM
Oh, also, by the way...

The current (old sdcc) firmware build process and code and be convinced
to compile for the 16f648 by tweaking some headers, so we can pursue
that avenue if we need to as well but it seems far less preferable.

_______________________________________________
Developers mailing list
Developers@reprap.org
[reprap.org]
Re: Firmware on the 16f648
August 23, 2007 07:35AM
Success on getting the 16f648 and the latest SDCC working!

I have made a minor modification to the stepper C code (a part of the interrupt service routine was commented out; I uncommented it) and that now works. I've checked it back in.

So a summary of what I've tested:

The extruder_0 code works in the extruder.
The stepper code works in the X axis.

I'm pretty sure that it'll all work now. The next stage is to program up a full set of 16F648As for Darwin and do an exhaustive test.

Having split off extruder_0 (polymer) and extruder_1 (pressure paste extruder) I have now decided to recombine them so we just have one type of extruder firmware. The selection between the two types will be soft, and made in the reprap.properties file.

All this means the road is now open to:

1. Always use the latest SDCC, and
2. Implement the ring buffer to remove the delay between plotted lines.

Item 2 is particularly important, as Ed needs that to do a definitive setup of all the reprap.properties parameters for Darwin.


best wishes

Adrian

[reprap.org]
[reprapltd.com]
Re: Firmware on the 16f648
December 19, 2007 12:16PM
That was a little premature. However...

I have now imported Andreas's improvements and corrections to the PIC firmware into Simon's experimental autoconf version of the code for the PIC16F648A. It all compiles, and - when put in a RepRap machine - works (at least it did for me...).

If you want to download it it's at

[reprap.svn.sourceforge.net]

You should probably also look at Simon's instructions on the forum at:

[forums.reprap.org]

We need to do a bit more testing. Then if this all pans out OK this'll become the Subversion trunk version and we'll do a release.

The compiled .hex files (remember they're for a PIC16F648 or PIC16F648A, not a PIC16F628) can be downloaded from [people.bath.ac.uk]. Unless you have more than one extruder on your RepRap, you can ignore the file extruder_1_.hex.

By putting this:

#define TESTLEN 53
static byte testArray[TESTLEN];

void init2()
{
testArray[TESTLEN-1] = 1;
...

in stepmotor2.c and increasing TESTLEN until the linker barfs I deduce that we have a whole 53 extra bytes to play with in the stepper code now!

Edited 2 time(s). Last edit at 12/19/2007 01:02PM by Adrian Bowyer.

best wishes

Adrian

[reprap.org]
[reprapltd.com]
Sorry, only registered users may post in this forum.

Click here to login