Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am in the early stages of planning for an input device which will consist of some as-yet-to-be determined number pf physical controls. From previous experience with such devices I have found that it would be extremely advantageous to have the device return data about the state of all controls in response to a query from the system, as opposed to reporting changes as they occur.

Assuming an acceptable poll frequency of 1000 queries per second or higher, is the embedded hardware sufficiently advanced to support this? Would a driver for such a device be excessively resource-intensive? What would a good ballpark estimate for the ram/cpu required on both the "server" and "client"?

share|improve this question
    
Can you use a hybrid model where the device reports changes as they occur and you poll less frequently? Depending on the number of devices to be controlled and the size of the messages returned, 1000 queries per second sounds like it might be pushing it. –  James McLeod Feb 18 '13 at 2:14
    
@JamesMcLeod, Could you go into more detail re hybrid? I could, I suppose, poll programmatically but I really don't see how yet. For example, say there is one button and I need to know if it is up or down at any given time. –  jamesson Feb 18 '13 at 2:23
    
What I have done in the past when controlling devices which purport to return status on changes is to use that functionality, but I've learnt not to trust it, so occasionally (once every ten seconds/thirty seconds/minute as appropriate for the device) I poll it for its status as well. –  James McLeod Feb 18 '13 at 2:52
    
The thing is - most of the time, the devices which report changes asynchronously work perfectly, and the rare occasions when they don't, I've been able to work with the manufacturer to get them to fix the problem, or found it doesn't matter that much if the status is delayed by a few seconds or more, once every few weeks - but make sure you log when the polled state doesn't match the asynchronously returned state. –  James McLeod Feb 18 '13 at 2:55
    
@JamesMcLeod. from your background info it seems you are very knowledgeable about this stuff, haven't you ever had to design such a device yourself? –  jamesson Feb 18 '13 at 2:55

1 Answer 1

up vote 1 down vote accepted

Assuming an acceptable poll frequency of 1000 queries per second or higher, is the embedded hardware sufficiently advanced to support this?

The short answer is yes :-). At 1000 queries/second, you have 1 millesecond to receive, handle, and reply to each query. There are several factors to consider. Two of the more important ones are:

  1. Do I have enough processing instructions to receive, handle and reply to the query. This includes reading the query, parsing the query, reading data from hardware registers, formatting the data for output, sending data, and overhead associated with handling the interrupt.
  2. Does the I/O channel being used have the bandwidth to carry the data?

You can get reasonably-priced dual core ARM processors on development boards running in the GHz range, which gives you a million instructions every millesecond. With a USB 2.0 interface, you can transfer up to 480K bits (15000 32 bit words) in the same period of time.

Would a driver for such a device be excessively resource-intensive?

No. Assuming a multi-core processor operating > 1 GHz, if your interrupt handling overhead and processing is 20K instructions, you are using ~ 1% of the CPU to handle your interrupts.

What would a good ballpark estimate for the ram/cpu required on both the "server" and "client"?

The RAM requirements depend on how much your application needs to cache. On the embedded device, you might size your RAM to handle three buffers, one to read information from the physical controls, one to hold the data while it is being formatted for output, and another buffer for the output itself. Each buffer is sized based on the number of bits of information per device.

share|improve this answer
    
Many thanks for the detailed info, it covers everything I need. For personal refernece, what would you expect the price differential to be for an individual chip vs this devboard? –  jamesson Mar 16 '13 at 18:29
    
Development boards tend to cost anywhere between 2x and 3x the cost of the CPU, but these boards also contain RAM and peripheral support. If you are in the early stage of planning, using a development board can make sense. For lower cost (and lower performance), look into Arduino (arduino.cc). At the higher end of price/performance, there are ARM motherboards. The prices range from about $5 on the low end to over $100 for high end processors and motherboards. –  Jay Elston Mar 19 '13 at 3:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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