Electronic – C++ microcontroller/processor selection

cmicrocontroller

I am having trouble selecting a microcontroller/processor for a robotics project in C++. I have a program working on my computer that is 1.5+ KLOC and relies on data in twenty other files to function, so please do not suggest I use another language. I tried translating it to C, but could not get it to work, perhaps because of the program's heavy reliance on fstream and strings. The program is about 1 MB on my computer right now and takes up 3 MB while running, so I suppose the microcontroller/processor would need either to be capable of supporting 4 MB of ram if it is von-Neumann/MHA and 1 MB of flash and 3 MB of ram for Harvard. I need PWM, SPI and UART/USART on the processor to communicate with other sensors, and I plan to use a hard drive for the other files and external ram for the program and its data. I will need at least 90 IO pins (40 IDE + 40 servos + sensors).

Summary:

  • >90 IO pins
  • PWM
  • SPI
  • UART/USART
  • if von-Neumann/MHA, capable of supporting >4 MB of ram
  • if Harvard, >1 MB program flash and >3 MB of ram
  • supports C++

What do you suggest? Please also provide information on how to program the processor, if possible.

So far, I have found Freescale’s i.mx25, but I am not sure how to connect this processor to my computer for programming, if it uses C++, or the details of how to turn my current Windows .exe program into a .hex compatible with this processor.

@m.Alin I am using a hard drive because I started out with AVR and found a tutorial describing how to communicate with an hdd from an AVR. I could not find a similar SD card tutorial.

@MikeJ-UK The program currently runs on my laptop, an x86-64 Windows 7.

@darron

"1MB binary implies more than 1500 LOC" The program is 643 KB now, not 1 MB. I apologize for the confusion. I said 1 MB because I am still working on and expanding the program, so the prospective processor will need to be able to handle its future larger size.

"add a peripheral board for the servos" "io offloading onto an FPGA…" I do not know how to do this. After a quick search, I was unable to find any affordable FPGA's. Do you know of any >$50?

@Rocketmagnet 1500 lines.

@vicatcu I do not think 8 io pins will be enough.

@AndrejaKo For the most part, the servos will not need to be controlled at the same time. I like your multiple microcontroller/demultiplexer option, but I do not understand what is wrong with using an i.MX25 with Linux? It has 128 io pins.

Best Answer

This sounds like a job for embedded Linux.

  1. Persistent file system. Forget IDE (save yourself 40 pins) and go for a board that uses a flash card.
  2. More RAM and Flash. Typical embedded Linux boards have RAM in the megabytes.

As for peripherals, driving 40 servos could be a question here on its own. How are you doing this now? For the rest of your peripheral requirements, here's a board that seems to fit that has a good community as well:

http://beagleboard.org/static/beaglebone/latest/Docs/Hardware/BONE_SRM.pdf

The tool chain has a C++ compiler, it has SPI, UARTs, and even a PWM. This is what's being claimed in the PDF at least, you'll have to make sure that there are drivers for all those peripherals available to you at the application level for whichever distro of Linux that you put on. Hopefully the one they provide has everything you need.

So basically, if you can port whatever you've written to a Linux PC, there's a good chance you can port it to an embedded linux target. However, I'm willing to bet that if all you're using from C++ is <fstream> and <string>, you could probably do a C re-write and save yourself the overhead of Linux.

Related Topic