9
\$\begingroup\$

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?

\$\endgroup\$
  • 1
    \$\begingroup\$ I think you'll need to provide power requirements as well. \$\endgroup\$ – kolosy Dec 22 '14 at 5:06
  • \$\begingroup\$ This doesn't answer your question, but you might consider looking at the new PIC32MZ family 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. \$\endgroup\$ – tcrosley Dec 22 '14 at 5:51
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – Funkyguy Dec 22 '14 at 6:10
  • \$\begingroup\$ If you can't tell what you need from the specs, can you just order samples and prototype? \$\endgroup\$ – Roger Rowland Dec 22 '14 at 8:26
  • \$\begingroup\$ @RogerRowland I could although that is a very lengthy process. Surly there is some way to find minimum specs for a program \$\endgroup\$ – Funkyguy Dec 22 '14 at 8:48
5
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – felixphew Dec 22 '14 at 19:55
  • 1
    \$\begingroup\$ 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.) \$\endgroup\$ – tcrosley Dec 23 '14 at 0:51
  • \$\begingroup\$ 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? \$\endgroup\$ – Mister Mystère Dec 23 '14 at 1:31
2
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.