FEZ Hydra - OSHW Signal Generator

There have been a few requests for a Signal Generator for the OSHW and in response to those requests and the fact that I had a few days leave, I decided to take-up the challenge.

Now I need some willing souls to test it for me :slight_smile: I am especially interested in someone that has a logic analyzer and can tell me how accurate it is and what the peak frequency is that it can achieve. I will of course be making all the code available, but right now I consider it to still be in development so I do not want to jump the gun on that.

At this time the interface a 100% drop in replacement for the GHI premium offering, with the following restrictions
[ol]
Only one SignalGenerator can be generating an async signal. This is not a technical limitation, it is just that I only wrote the code this evening and have not added support for scheduling multiple generators asynchronously. You can of course have multiple instances and fire them, but starting one while another is running will stop the currently running generator.
I have no clue what the peak performance is. I know that the generator can quite accurately generate frequencies in the audible range, I tested that with a music tuner.
Disabling interrupts results in less accurate frequencies. This is due to some tricks I have implemented to improve performance using the interrupts.
I just remembered, in my excitement that it all worked, I forgot to implement the IsActive property. Well I need to get to bed now so that will be tomorrows job.[/ol]

I found the AT91SAM9RL64 (Hydra processor) quite challenging as the timers are very limited and I need to do a number of tricks to get the generator to perform reasonably well at relatively low frequencies. So I am at the point where I need better test equipment to see if I am making things better or worse, I will need to get a late Christmas present :slight_smile:

The Firmware and the related DLL can be obtained from my skydrive

To use the generator you can do the following

[ol]Use MFDeploy to deploy the firmware to the Hydra
Reset the Hydra (This is very important)
Create a new project, add a reference to the managed dotnetwarrior.OSHW.Hardware assembly
Write code to use the SignalGenerator[/ol]

6 Likes

Another super contribution from @ taylorza

Do you have particular test code in mind? I can test it later tonight.

@ Gus - Thank you!

@ Architect - Thank you for offering, I appreciate it.
The two things would be to test the Carrier Wave and see if it is accurate and at what frequency it starts to breakdown. The other test would be the generation of a frequency with a pulse buffer, at the moment I test with 100 1126ns pulses which gives me 444Hz,

Out of interest you could test the Set method which is async, but I do not have high hopes for it just yet. The code is only a few hours old so it still needs some optimization.

Fantastic! If I can get my current problem solved, I’ll test it some tonight.

@ taylorza - Awesome work…I’ll give this a run with my Hydra and see if I can make my IR LED Array module work using this. Would be great to extend support for that module beyond Spider.

Two questions:
[ol]Gus, is it too much to hope that major contributions like this could find their way into the “official” firmware distribution from GHI?
Is there any hope that this could be ported (or, more likely, reimplemented) on Cerberus family boards? Especially now that GCC compilation is available?[/ol]

2 Likes

@ taylorza - I am having problems getting it of your SkyDrive. Is it shared?

I can get to it fine. I just emailed it to you.

Thanks. I’ve tried to see it from my SkyDrive WP8 app. Will check from laptop in a bit.

I would be quite surprised if it can achieve the 38000Hz carrier at this point. I have no doubt that it will eventually be able to, but I suspect that the implementation still requires some optimization. I will get started on implementing that DL40 based logic analyzer as suggested by @ IanLee74.

Based on playing around with DL40’s Cortex-M0 and the STM32F4Discovery, I suspect that an implementation on the Cerb would be a lot smoother. I have not looked at the work that @ NicolasG has done to get GCC building 4.3 and if that can be leveraged to get 4.2 building with GCC, I am sure it can.

I have updated the firmware with a few improvements

[ol]The generator is now totally dissociated from the timer interrupt. This means that disabling interrupts will allow you to generate much higher frequencies.
The non-blocking Set has been optimized slightly, there is still some work I can do here.
The IsActive property now returns true if the generator is currently running[/ol]

You can get the latest firmware from my skydrive

@ devhammer, this build would be the better option for testing the IR interface.

@ taylorza - Thanks…haven’t played with the previous build yet, so I’ll go with the newer build when I can get to it.

@ taylorza - First attempt at deploying the firmware was a fail. The Hydra ended up unresponsive. I’m in the process of reflashing with the GHI firmware, after erasing via the SD card process, and then will give it another go. Will keep you posted.

@ taylorza - I believe I have the firmware updated properly now.

I created a new Gadgeteer 4.2 project using Visual Studio 2010, and tried adding a reference to the DLL you specified, but I’m getting an error message that the assembly name or codebase was invalid (see the attached screengrab for the error details).

Any suggestions?

@ devhammer - That might be that I did not update the managed DLL with the latest version when I updated the firmware. I will do a fresh build of everything and put that up on the skydrive. I will post here as soon as it is done, it should be within the next 30min, hopefully sooner.

@ taylorza - OK. Will check back in a bit, thanks.

@ devhammer - Ok, there is a fresh build on the skydrive - FEZHydra-SignalGenerator-0.2.1.zip

@ taylorza - Still getting the same error.

Do I need to re-flash the board again?

@ devhammer - Yes, you will need to reflash. The managed code needs to match the firmware build. You also need to reset the board after flashing the firmware before loading the managed application.