Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHi,
I'm not sure of the way you are using context parameter inside irq handler. I can't remember its usage, so I cannot say if there is an error. Anyway I'd work in a different way. Why don't you simply read the rden pio and update count variable inside handler? In a opposite way, you could even do everything in the while loop, without irq, sampling the edgecapture register. This should work with the 250kHz rdclk frequency you require. But if you then want to use uCos and iniche in order to transmit data with tcp/ip, I think the realtime requirement could be hard to achieve. Due to task switching, you'll probably have more than 10 microseconds uncertainty on data sampling, even if pio sampler task runs at maximum priority. (in a similar case, I now achieve 100us real time precision with uCos/iniche, but it's a more complex system with 2 tcp/ip ports, so I don't know the same applies to yours; probably you can do better) So, the answer to your question about ucos was implicit in what I said above: you have multithreading, configurable priorities and everything else. You can easily send data to 4 destinations, but this depends from the protocol you want. A good starting point for uCos with iniche is the simplesocketserver sample: you'll find there almost everything you need. Regards Cris