Tuesday, March 01, 2011

Going for 32 bit embedded processors



In which your narrator begins to cobble a next-generation Reprap controller board together out of much bigger vitamins than has previously been possible.

The controller for the Bits from Bytes Rapman has long been the most sophisticated in the world of Reprap printers. It's use of the PIC32 MCU gives it the power to do things, like support an LCD display, SD cards and 0.1 mm gcode steps without difficulty are very difficult to do with 8 bit MCUs. There are two barriers to it's widespread adoption in Reprap printers, however.

The first is that PIC32s typically come as 100 pin surface mount chips. That means that you have to do some fairly sophisticated PCB design and get the damned chip soldered on properly. That's not impossible, but it's not easy, either.

The big barrier, however, has been the lack of inexpensive compilers for PIC32s. The one from Microchip is very good, but costs over $1K. Recently, that situation has been remedied by a Serbian firm, Mikroelektronika. I had had experience with their PIC 18F compiler and found it both very reliable and possessed of an enormous library of library functions which made it extremely valuable as a development tool.

Thus, when I heard last year that Mikroelektronika had undertaken to create an inexpensive compiler for PIC32 chips I was immediately interested. After a long development and beta cycle they did their formal release this morning.  They offer inexpensive C, Basic and Pascal compilers for the PIC32.

Some time ago, I resolved to build up my next printer rather than buy another BfB product.  The ultra-reliable BfB extruder and controller board were two technologies that I intended to bring across.  I wanted, however, to have two extruders and a somewhat bigger print table to accommodate them better than Rapman allows.

Laszlo created an inexpensive, easier to repair hot end than BfB offers which I also intend to use in the design.



As well, recent purchase of a hobby lathe ...




... will let me experiment with large diameter precision lead screws which can double as structural elements should cut down on the amount of steel in the printer rather dramatically.




The big advantage to the new Mikroelektronika compilers, however, is that they also offer an inexpensive line of prototyping boards.  That will save me the development time of putting together a new board with technology that I am not familiar with.  I ordered their most expensive board {$169}...




which includes everything that I need save stepper drivers.  I also ordered one of their stepper driver boards. to test with it to test my firmware with ...




before I integrate the heavier amperage Pololu driver board that has been used in a number of other Reprap controller boards.




The current situation is so much better than we faced when we began the Reprap project in 2005.  Then you were pretty much doomed to building up boards from scratch.  These days you can buy inexpensive boards and add-on miniboards to build up an inexpensive yet very sophisticated Reprap controller board quite easily.

Should my controller design catch on, I suspect that other Reprappers would want to use this much smaller and less expensive graphics board in Mikroelektronika's stable ...




...  which has pretty much everything the larger board does.




25 comments:

Unfold Fab said...

Holy smoke! That's a nice board and extremely affordable! Looking forward to your progress on this.

Cefiar said...

Looks good Forrest. I look forward to work on this front!

Unknown said...

So you have to buy a $200 development system, a $99 system board, and $30 in stepper drivers versus $50 system board, $25 (diy) expansion board and $30 in stepper drivers. Doesn't seem like the benefits outweigh the costs. (Plus who knows about that C compiler.)

Now just to be fair, if you follow this thread @ Microchip you can have a free compiler for pic32.

Forrest Higgs said...

@keltor Yes, there is a limited edition of the PIC32 C compiler. Bogdan is developing a PIC32 board using it. As well, there are certainly cheaper PIC32 development boards out there, though, I doubt that they have the spectrum of features on board that the Mikroelektronika ones do. Mind, one certainly doesn't need all of the features I intend to be using for a lowest cost controller.

I am taking a different path which has advantages for me in being efficient with the limited time that I have to devote to creating a new printer. Others may find themselves in a similar situation. :-)

Unknown said...

That free compiler is gcc-pic32. Microchip's compiler is based on gcc, so they had to release their changes.

Forrest Higgs said...

I repeat...

"I am taking a different path which has advantages for me in being efficient with the limited time that I have to devote to creating a new printer. Others may find themselves in a similar situation. :-)"

I am really not interested in getting into a dick measuring contest about the relative merits of gcc/Microchip's compiler versus the one I've chosen to use.

Kliment said...

Sorry, but what?

There is no issue at all with submillimeter precision, LCD control or SD card support on AVR or other 8-bit machines. In my own firmware I have micrometer precision, and I've made an SD printing patch for the tonokip firmware that I've been printing from exclusively the past couple weeks. There is simply no need for crazy expensive closed-source single-supplier boards for the functions you describe.

Kliment

Forrest Higgs said...

@Kliment "Crazy expensive" is a matter of perception. There is also nothing to stop me from taking the firmware I develop on the Mikroelektronika development board and use it on a much cheaper purpose designed, open source board employing the PIC32.

Bogdan Kecman said...

I'm using C32 with mplab and recently with MPLABX for a while and they are good, almost great, but I have to admit that mikroelektronika's compilers are making better code then both C18, C30 and C32. better being both faster and smaller. The big downside is that mikroC is not compatible with pickit2/pickit3 nor with mplab/mplabx but if you purchase their debugger you don't really care much about pickit :D

As for the huge number of well written and well tested libraries in mikroC - I don't think they are of much use for reprap project but I believe the author's idea is not to use pic32 for reprap only but for other purposes too.

All I can say is - I'm waiting to see the results :) - if you have questions regarding pic32 you know where to find me :)

Forrest Higgs said...

@Bogdan "if you have questions regarding pic32 you know where to find me :)"

Indeed, I do! I'll not hesitate. You've been a good friend, Bogdan. :-)

annodomini2 said...

Any specific reason you went for a PIC32 architecture over some of the other available options, such as ARM or AVR32

Unknown said...

Little more research, both compilers are just gcc (different version though I believe), so the code and C compliance should be acceptable.

Really I hope we can come to some sort of universal control interface so we can use something like libreprap to bind any software choice to any electronics. Then we can have all sorts of different electronics (cheap vs really advanced) and still be able to control it with the same software on the computer.

Forrest Higgs said...

@annodomini2 I started using PIC16Fs when Reprap began in 2005. When Reprap shifted to Arduino, I stayed with PIC, so I have a lot of experience with that platform.

As well, I own a BfB Rapman which uses a totally standalone PIC32 controller board that taps data from an SD card. That system has been very robust, so I am going with that technology for my next two extruder printer.

Forrest Higgs said...

@keltor "Then we can have all sorts of different electronics (cheap vs really advanced) and still be able to control it with the same software on the computer."

This is unclear. Are you talking about software on a PC or firmware on a controller board?

Unknown said...

Sorry if I was not clear - it would require effort on both sides. Currently the effort is already underway on the PC side ala libreprap. If we have 3 or 4 different electronics platforms (which we will soon), it would be much easier if everyone followed the same interface standard. Then there's no issue with switching from AVR -> PIC32 or PIC32 -> ARM. Likely you could have in the future two units hooked up to one machine (which is what I have currently - 4 machines hooked up to my development box) and all you will need to do is switch between a configuration profile.

This is what I do with EMC at the moment with my 3 CNC machines - I create the files in Inventor or Autocad then export to EMC and switch profiles in EMC to the correct CNC machine and off it goes.

Forrest Higgs said...

@keltor A couple of issues.

First off, I haven't used a PC/printer link in a year and a half. The Rapman I use is a stand alone system that takes an SD card. How does that work with your librerap{?} scheme?

Second, I'm planning to leverage ethernet connectivity to link my next printer to the internet so that it can be monitored and controlled in extremis from anywhere. Is librerap going to be able to do that?

Forrest Higgs said...

@keltor A quibble. It seems odd to be, on the one hand, evangelical for open source with gcc compilers while, on the other, using, by your account, Inventor and Autocad to design printable objects.

I use the open source Art of Illusion app pretty much exclusively.

Unknown said...

I did not evangelical OSS. GCC is a high quality compiler, as is the IBM, SUN and Microsoft C compilers. Some projects have used derivations of other compilers which honestly produced horrible code. Little companies aren't really making their own C compilers, they license code from someone and make alterations.

I'm actually trying to convert my CAD work over to something more open source - OpenSCAD in my case. That is still very in transition at this time for me.

Making a similar transition with my electronics to KiCad - which is honestly fairly good except for the lack of libraries.

Forrest Higgs said...

@keltor I'd be interested in that link you've referred to that talk about the Mikroelektronika PIC32 compiler really being gcc.

Unknown said...

Unfortunately I relied upon some bad info with the Mikroelektronika PIC32 compiler, it's not gcc, it's in fact not even C, but like a weird alteration of standard C. It's apparently something they developed inhouse.

I personally won't be using it, but I hope it works out quite well for you. Maybe you can write a post about how the SD Card helps vs using a USB/Serial cable. I've always wondered what the attraction was. (Though I guess with a Huxley/Small unit it might be way more attractive.)

Forrest Higgs said...

@Keltor "Maybe you can write a post about how the SD Card helps vs using a USB/Serial cable."

I've already used both and both work, after a fashion. My use of USB was limited to HID transmission speeds, so I put in a large EEPROM buffer on my controller. That worked very well.

SD works as well and is cheaper to implement than EEPROM. Add an LCD screen and you have a stand alone printer that draws about 40 watts while printing. Using USB with printer plus PC runs that up to several hundred watts, which isn't very green.

The big hassle that I've seen is that if you're using your PC for other things that can potentially hang your system up you tend not to want to do long prints.

Unknown said...

Perhaps the real trick would be add flash storage to store the file during the "print".

Forrest Higgs said...

SD cards ARE flash storage. :-/

Erik de Bruijn said...

I think your reasons for looking for a more powerful unit are valid. Even an ARM Cortex processor isn't much more expensive than an AtMega and it is much more powerful (DMA, integrated ethernet controllers, etc.). By making things more efficient (e.g. tonokip firmware) you can go very far without needing something more powerful, but making the switch at some point is good. AtMega will be a good, working solution until this is developed a little further. Of course a fully fledged development board is more expensive, but this isn't what would be used in the end. When prototyping is done a cheaper, dedicated board can be designed.

We're looking into ARM for the same reasons you're looking into 32 bits PIC.

I've really tried to use BitsFromBytes' electronics boards, but after buying two versions I stopped because of the insanely bulky toolchain "MPLAB" that was closed source and required me to keep a windows installation. Things were complicated by the fact that BitsFromBytes did a few incomplete open source releases of the firmware and then stopped releasing it when I'd bought two of their boards for (200 euro+ (incl. 20+ euro power supply). I really regret the time and money I spent on this. The problem is BfB are not really (developer) community centric.

Erik

Forrest Higgs said...

@Erik "The problem is BfB are not really (developer) community centric."

There were questions about that all along. Now that they've been acquired by 3D Systems, sadly, there is no question whatsoever.