9

Everybody knows its easy to develop a proof of concept for an embedded device on a rasbperry pi or even a PC, although when it comes down to choosing a microprocessor for your product, it is difficult to be sure your choice will allow your concept to work optimally.

I currently have a media streaming project successfully working on the raspberry pi, although the pi is much to big and bulky for it to be proper as an end device. Also it is stated that the end device is custom. I'm having a hard time finding confidence in processors that I can use.

What is a good process as to finding out if a processor is powerful enough to run my application?

Basically my requirements are:

  • USB host or embedded TCP/IP stack for WiFi operation
  • I2S/PCM media protocol
  • I2C for peripheral configuration

Finding chips with those properties is very very simply. It honestly couldn't be simpler. The issue is being able to tell if the chip is fast enough, processing and operation-wise.

I've looked at the LPC4337 quite a bit and I feel like it would be suitable although the development environment is giving me quite a bit of trouble, for that reason I'm still looking around, which led me to the CC3200 from Texas Instruments, although that controller only runs at 80 MHz and I'm not sure if that will be strong enough for real-time media streaming.

What are some steps to make sure a processor is fast enough for my application? Like how do I know if an 80 MHz processor will be good enough or do I need something on the order of 204 MHz or even higher?

Funkyguy
  • 3,558
  • 1
  • 21
  • 45
  • 1
    I think you'll need to provide power requirements as well. – kolosy Dec 22 '14 at 05:06
  • This doesn't answer your question, but you might consider looking at the new [PIC32MZ family](http://ww1.microchip.com/downloads/en/DeviceDoc/60001191C.pdf) of microcontrollers, which have twice as much Flash (2MB) and three times as much RAM (512K), along with USB 2.0 host, I²S and five I²C modules for the same price as the LPC4337. The IDE (MPLAB X) and compiler are free to try out, but after a trial period you have to pay for the optimized compiler if you want one (the unoptimized GCC compiler remains free). Microchip has royalty-free libraries for the USB and TCP/IP stacks. – tcrosley Dec 22 '14 at 05:51
  • 2
    I think some may be missing the point of the question. I'm not looking for a recommendation of parts. It is simple to make sure there is enough space on the chip or the proper peripherals are there. I'm more so looking for processing parameters and steps as a guide to make sure I select a powerful enough processor. As in its speed. – Funkyguy Dec 22 '14 at 06:10
  • If you can't tell what you need from the specs, can you just order samples and prototype? – Roger Rowland Dec 22 '14 at 08:26
  • @RogerRowland I could although that is a very lengthy process. Surly there is some way to find minimum specs for a program – Funkyguy Dec 22 '14 at 08:48
  • I suspect that you would need to prototype anyway to find out if the CPU speed really *is* the bottleneck that you need to worry about. I know it doesn't help much, sorry. – Roger Rowland Dec 22 '14 at 09:18
  • Wow, yet another claim that the Raspberry Pi is "too big and bulky"? I'm trying to resist the urge to [old-school rant](http://electronics.stackexchange.com/questions/117210/where-to-start-building-this-wifi-video-streaming-circuit/157238#157238) like a cranky old man, like I did last time. – davidcary Feb 27 '15 at 14:36
  • @davidcary you probably should resist. You don't sound like you want to help. And it is too bulky. It is a 700 MHz Linux box complete with HDMi support, multithreading, GUI, etc.. I only need a single thread – Funkyguy Feb 27 '15 at 14:52

3 Answers3

5

It depends on how confident you need to be. I work in the space industry and this is typically achieved via what we call "CPU, RAM, ROM budgets". A budget, be it cost power mass or anything else, is breaking down your process in manageable items which you can quantify and sum them all up to get the overall demand. You then take a safety factor that depends on the maturity of your project, decreasing with time to account for the growth in demand. Early on, it heavily relies on experience and then is refined over time as technologies are selected.

  • ROM is relatively easy. You know how much a stack/library/driver roughly takes in ROM memory: either given by the author, or you can compile it without uploading it. That figure can change a lot every time you change your code though because of compiler optimisations.
  • RAM is a lot trickier. Some tools in specialised integrated development environments give you runtime estimates, and I can see how this could be done but I'm not aware of any generic tool - say, provided by GCC (anyone knows otherwise?). Sadly it does sound like it's down to counting the biggest or most allocated elements of your code (accounting for variables lifetime).
  • CPU is more complex in that depending on the architecture (CISC or RISC) the MIPS (Millions of Instructions Per Second, proportional to the CPU clock frequency) could or could not be representative. Because if you have the code at hand, you can break the most critical section down into instructions and calculate the required MIPS from the time requirement. Any non-disabled interrupt SHOULD be considered to be triggered at that point - Murphy's law and all that.

The above is extremely difficult to accurately determine when schedulers kick in, as soon as you have threads (unless threads are manually allocated to cores) and operating systems. It should be manageable for simple microcontroller codes, but is it worth it for your application?

This is only my participation: even though I design integrated systems I have not been responsible for those particular budgets (which are inputs for me), and I'm actually very interested to know experts' stories on that.

Addendum : With real-time systems, it is usually easier to assess the adequacy of the system to the task via the maximum sampling time which depends on latency/delays in the transmission of the information throughout the workflow, and the maximum time taken by each sample of task.

Mister Mystère
  • 9,477
  • 6
  • 51
  • 82
  • `avrdude` can provide estimates of how much RAM is taken by global variables, but you have to run it with the dry run option because it's fundamentally an uploading tool. – felixphew Dec 22 '14 at 19:55
  • 1
    The hardest part to estimate IMO is stack and heap usage. Our current embedded system (proprietary OS), running on a PIC32, typically has over 25 tasks running, many of them needing a couple K of heap or more when they are active. You get several of those going, plus some heavy stack usage and you can soon be close to running out of RAM. I just wrote a recursive routine a week or so ago and had to be very careful of local variable stack usage (no arrays etc.) – tcrosley Dec 23 '14 at 00:51
  • Interesting, thanks. Do you estimate the amount of RAM allocated by your code (code analysis or particular tool), or do you measure it at runtime? It seems to me that MIPS is a bit more difficult to estimate because it cannot be estimated from analysing the code without breaking it down to instructions, unlike RAM usage (possible, not easy). Threads make the task incredibly more difficult, but it sounds like CPU analysis still requires more steps - it is simply less of an issue in general. What do you think? – Mister Mystère Dec 23 '14 at 01:31
2

I am going to simplify your question to, "How to find out if a microprocessor is fast enough"?
You need to identify the process/procedure that requires the fastest execution time. If your processor can execute the instructions required in the given time, or less, then it is fast enough.
Lets look at an example: Your fastest requirement is to process a loss of power interrupt; this requires 10,000 instructions to be executed in 10 milliseconds. You will need a CPU with at least 1 MIP. To convert this to "MHz," you need to know the number of clock cycles per instruction (cci). Lets assume it is 10 cci, your CPU would need to run at 10 MHz, or faster.

Guill
  • 2,430
  • 10
  • 6
0

If you are looking at lowering BOM cost sometimes those Shenzhen manufacturers have some surprising offers. One example: Allwinner A10 have more computational power and connection options than Raspberry Pi but probably will be cheaper if used in your design. If you are looking at the same cost as the Pi the Allwinner A31s is 6-8 times more powerful.

Maxthon Chan
  • 2,853
  • 1
  • 16
  • 33