Main Site Documentation

Using SSC or SPI with high data rates


Hi Folks,

I have to connect to an ADC, which pumps 16 Bytes of data each 20.48µs and with .net MF it is not possible. No problem, just write plain c code for that.

But there were lot of open questions:

Can I run a task, serving hardware interrupts?
Can I set some flag to signal the foreground (.netMF) that a bunch of data is ready?
Is it possible to control the hardware (SPI, DMAC, SSC …) from low Level C code without restriction?

And I have to connect to mobile Internet. I think about running a web server on that device allowing configuration and monitoring. The results of the actions should be send as emails once a day.

Is there a webserver available?
Is there an email Client available?
Is there a driver to use a GPRS oder G3 modem connected to an USB port or some other solution.

Any samples?

Thanks for Input.

With best regards



Have you looked at RLP? It has ability to do that.


… as I wrote ‘native C’ I meant RLP, but how can I serve Interrupts there and how can I set flags, call callbacks or whatever to communicate async with the .netMF part of the app??

With best regards



Look at the RLP extensions at the bottom of the following page:

You can post a managed event from RLP back to NETMF. There are also interrupt related extensions and some task management as well.

RLP examples on codeshare can be useful as well:


… thanks.
Looks fine. seems, there will be anything available, which I need.

Only the memory management and marshaling large data (will have 100k and maybe more), can make troubles. Hope there is a good solution somehow.

Thanks again.



You are welcome!


@ Gerhard - I’m just curious… is the ADC going to produce a continuous stream of “16 Bytes of data each 20.48µs”? If so, what will you do with all that data in managed code?


Hi jasdev,

oh sorry, forgive my blindness, cause I do this project whole day long. I just sample for 100ms. After that, the data has go to a file and later on for post processing.
Before the next cycle starts, some relay mux have to be set, so there is 20 to 40 MS without sampling, or as much time as needed to save the data.

My target: Realtime layer, as configuring the Hardware, servicing Interrupts and so on should be written in C and higher Level functions like storing data on a SD Card, post processing … will go in .netMF.

And I forget to explain, that after some hundreds of this cycles, there will be a break for hours, so there is plenty of time for post processing.

Once a day the data is send as attachment of an email, so I also ask for the connectibillity of the G400D to mobile Internet.

Lastly, a little web server will be nice to health check the system, which runs totally unattended and do some settings.

With best regades



I don’t think you will be able to store data on SD card in less than 20ms


… hmm, the G400D is running at 400Mhz and we do it on an industrial computer board running WinXP and using a hard drive before. This board running at 500Mhz.So I hoped, that without all the stuff of an desktop OS and with the usage of an modern SD card, it will do the job in time. I guess I can use Memory-Memory DMA lransfer, which is supported by this processor.

But this isn’t an issue, as Long as I can do multi tasking. Between cycles I have to send small messages via RS485 to the relay muxes and there relays have to settle, so there is plenty of time for the processor to do administrative stuff, as long as the hardware related operations of sending characters on serial lines and awaiting timeouts were done in hardware using DMA and Interrupts.

And if it takes little longer, also not a big problem.

With best regards



Ok I didn’t know you were targetting G400. I was thinking about EMX perf that are not bad but not enough for your real time constraints.


… correct. First attempt in an early stage of this project was to use the EMX but it quickly turns out, that the performance is to low.
Than I want to use two processors, an Atmel Controller programmed in plain C making all that real time stuff and an EMX for the high level administration, but the available controllers have only small internal memories. So the harware is growing and growing, but with the G400D I have (probably) enough processing power and enough memory to do all in one.

Just have to tackle the RLP beast and find out, how I can establish a realtime layer beyond .netMF. I also have to move big amount of data between this two Domains, which could also be a beast to fight. Hardware is shrinking, thats the good news.

With best regards



I would first test the max write speed to an SD card, that could be the bottleneck. I assume it will be faster as G120 which is currently 135KB/Sec max on a Extreme Pro SD card (95MB/Sec)


… thanks for that Input. That is really not so much …
Roughly calculated, I would need 625kB/s, Little too high …
Do you write the data byte-wise or do you have the whole content for a file in a buffer?
Maybe this make a big difference.

Thanks again for that important Input.

With best regards



wrote 1000 blocks of 1024 bytes in a loop… also tested with smaller and larger blocks but 135KB was the max i could get


… ok, thats more or less the same I would do.

400Mhz is not everything, but lot more than on EMX or SpiceWorks or other sticks like that.

I want to have a stick, containing a controller and memory and allows me to program the high Level stuff in a high level language. I am not amused to do everything in plain C including sending mails and web server and data storage and … this is not really productive.

So I hope I can establish a real time layer beneath .netMF for my control tasks and communication and use .ntMF and libraries to do the rest.

With best regards



Yes that’s all good possible using RLP


… ok, speed isn’t an issue for the web stuff, because it is only for monitoring the system from time to time an do some configuration. The data rates of mobile Internet were very slow, because the system stand off civilication, on top of mountains and there usually is GPRS the best you can get.

Hope somebody have drivers ready, because using such things with mobile Internet isn’t so bad idea.

With best regards



… ok, and the communication is between some mobile radio module and the G400D. If this is so, than it will be a fine thing.
As Long as I know what module to place, I will get it running without problems.

Thanks for that Input.

With besr regards



@ Gerhard - In my RLP music driver I needed to pass data from managed code to native code. A static byte buffer was passed to native code as a buffer pointer, not copied. The native function returned control immediately. The native code continued to read data from the buffer (using an interrupt service routine) while the managed code filled a second buffer from SD card.

You could do a similar thing by passing a pointer to an empty static byte buffer to native code, fill the buffer using your ISR, and then post a managed event from RLP back to NETMF (as @ Architect suggested) when the buffer is full.