Project - DL40 - I/O Module Firmware

Maybe it’s not necessary. Just trying to understand your intended usage. As-is, it looks like once you create the counter pin it just reads until the UINT buffer is maxed out. Then what happens? What if I wanted continuous counting for the life of my program? I would think at least it should have start & stop methods with counter reset happening on stop().

@ ianlee74 - Right now the counter will just wrap around and continue counting.

I think it might be worth looking at how it’ll be used too, to see if there needs to be time interval between reads or a frequency estimate?

@ Brett - that is a good idea, I thought I was close to finished with this driver :slight_smile: but maybe it needs a signal generator and full pin capture which provides a buffer of time intervals between pulses.

I agree. How would I know I missed a roll over or possibly multiple rollovers. Running at 12MHz it won’t take long.

@ ianlee74 - agreed, right now the driver is only exposing the raw MCU functionality over DaisyLink, from what I can tell anything I add to handle the rollover will reduce the frequency that can be achieved, using the timer to achieve 12MHz means the timer peripheral is dedicated to the task.

To detect an overflow I would need to use a match register which triggers an interrupt on overflow, this could be used to extend the range out to 64 bits then the user would not need to be concerned about overflow. The only concern I have is the latency of transferring the data increase due to the longer data stream. But I can give it a go, unless you guys have any other ideas for me to try?

Sounds like a great place to start.

Great, I will give that a shot tomorrow. These data sheets are tough going, they really just give you the bare minimum, I have been reading how the PWM capability is being exposed and it take some getting used to, this will be a good intro to using the match registers before jumping into PWM. Cheers.

You’re inspiring. What are you going to do next? Port NETMF to the DL40? :wink:

I did not have much time with this today, I only managed to quickly implement the UInt64 counters. So now when you read the value from either a PulseCounterPin or a CapturePin the value will be a 64 bit value regardless of the physical hardware implementation.

This is the first step to addressing the points raised by IanLee74. I will also add the ability to reset the counter on demand, the native code is already in place, but the managed code needs to be written and tested before I can make it available.

Thank you all for the input, I appreciate it and will strive to address all concerns and questions regarding the driver.

4 Likes

Great work @ taylorza.
looking forward to trying it once the reset is added.

@ MikeCormier - The latest drop actually includes the reset, I just didn’t mention the drop because it was a minor change. Check the usage example for the latest release.
Btw. Please feel free to suggest enhancements/features you would like to see. I am guessing you want auto-reset on read :slight_smile:

autoreset on read would be a good feature.

@ MikeCormier - Done. I just updated the code share with a new revision that supports reset on read. When creating the Counter or Capture pin there is an optional argument which indicates if the pin should reset the count on read.

@ taylorza you inspired me to take a look from easy Micro.NET to low level C programming. Luckily I found JLink at work, all abandoned with some dust on it, and took it home.
I would like to contribute to your DL40 FW. My first task could be ADC. If you agree, please upload your code to source control? Maybe to codeplex? If you like, I can upload sources to my own SVN server.

@ jernejk - That sounds great, it might be a good idea to move this out to codeplex. I would be happy to have you contribute, I will try get the code up on codeplex a soon as possible, but I can’t promise that it will be before next week. I will post here as soon as it is up. Would you prefer a SVN or GIT repo?

@ taylorza, nice. I prefer SVN because I never used GIT before, but I use SVN every day at work. So let me know when you upload your project.

The code is now available on Codeplex
http://dl40io.codeplex.com/

That was fast. Thx

@ jernejk - Ja, I got a gap so I thought I would use the time to do this quickly. I just hope I got every thing up, I have not done a checkout and build yet.