Jack Gassett

DesignLab 1.0.4 Released!

Recommended Posts

Hey everyone,

 

Just in time for the weekend, here is a DesignLab 1.0.4 release with a bunch of bug fixes. This release should address many of the problems people have been having in Linux.

 

DesignLab 1.0.4 - 2015.03.06
[zpuino]
Fix newline's in the STDIO library
 
[ide]
Numerous bug fixes, particularly for Linux.
 
DesignLab 1.0.3 - 2015.02.27
[zpuino]
Enabled DMA channels
Increase the memory address lines of Papilio DUO to support 2MB
Disable POSIX interface for Papilio One boards to save memory.
Allow new 2.0 libraries to specify the Wishbone slot using (Wishbone(1)).
Full malloc() support.
Lots of bug fixes.
 
[ide]
Merged in the Arduino 1.5.8 code.
Serial ports are detected and labels are added to identify the type of board connected.
Warn if people forget to synthesize bit files.
Comment out #define circuit when saving a library.
Papilio Loader upgraded to 2.7.
Support adding a config.h file for project wide #defines.
Lots of bug fixes.
 
[DesignLab Libraries]
New DMA VGA adapter with 16-bit color and dynamic resolution and uses AdaFruit_GFX library.
PNG and JPG libraries for use with the new VGA adapter.
ZLib compression library
Dynamic PLL library.
SD card library and examples.
FatFS for use with POSIX names and VGA adapter.
Dual DeltaSigma DAC library.
Basic Building Blocks library with Counters, bus taps, Dividers, etc.

Share this post


Link to post
Share on other sites

Hey guys - there's a compilation error for anything that uses SPI in my new 1.0.4 installation that has been there from the previous 1.0.3 installations. This example is from the analog wing example. The fix is easy (comment out line 16 of libraries/SPIADC/SPIADC.h). I thought I had seen this change made previously in github. Or perhaps the fix is actually supposed to be elsewhere?

Build options changed, rebuilding allIn file included from WING_Analog.ino:50:C:/DesignLab-1.0.4/libraries/SPIADC/SPIADC.h:16: error: redefinition of `struct CS'C:/DesignLab-1.0.4/hardware/zpuino/zpu20/libraries/SPI/SPI.h:55: error: previous definition of `struct CS'Error compiling.

Share this post


Link to post
Share on other sites

Having seen ruzzmon's comment above I decided to give this example one more try. Previously I have got no further than the error message so I made the suggested change and tried again. This now compiled cleanly ( no errors, plenty of warnings!)  however it still failed to get beyond the first part of the code. By adding print statements I was able to establish that where the interrupts are turned on it never continues. The line that seems to cause the problem is the one that says:-

 

  INTRMASK = BIT(INTRLINE_TIMER0); // Enable Timer0 interrupt
  Serial.println("S2e.");
  INTRCTL=1;     <---- problem line
   Serial.println("S3.");
  //Setup VGA Hello World

The green lines are the prints I added.

 

The output was:-

SmallFS Started.Opening Mod File from SmallFS.4D 2E 4B 2E  Number of patterns: 23Memory needed: 96440Loading sample data ptrAll loadedS2.S2a.S2b.S2c.S2d.S2e.

As can be seen the code stops after the line INTRCTL=1;

 

Now I'm not an expert on Arduino or FPGA but it seems to me that this is trying to enable interrupts. However I cannot find where the interrupted vector is set up.

 

I would appreciate some help in how to debung this problem. I assume it should call the ZPU interrupts routine "_zpu_interrupt" but don't understand how it knows that is the routine to call.

 

I would also like to say that I think the progress in design lab is excellent I have recently purchased a Papilio DUO -2 MB, and the new design lab persuaded me to dig out my older Papilio pro and logicstart megawing whilst waiting for the arrival of the shields that I have ordered.

Yours
Peter D Hull

Share this post


Link to post
Share on other sites

Jack: We need to port that code to 2.0 (i.e., Timer class).

 

Adding a proper "periodicHZ()" call shoud do the trick. Interrupts are now handled internally, and need to follow different rules.

 

Alvie

Share this post


Link to post
Share on other sites

Ok, yes, I think that sketch just needs to be updated with the 2.0 timers right? That sketch must have fallen through the cracks...

 

It's been hard to go back over every sketch after the upgrade to 2.0...

 

Jack.

Share this post


Link to post
Share on other sites

Jack,

Is there a guide to the differences between 1.0 and 2.0 that you can point me at?

is there a guide to the new rules?
I realize that I have no idea how they differ and if I'm likely to be using both  (I have a Papilio pro and a Papilio Duo.) I would like to understand the differences.

Has the 2.0 upgrade replaced completely the earlier version?

Many thanks

Peter

Share this post


Link to post
Share on other sites

Hello Peter,

 

I just realized it wasn't very clear what we meant by 2.0, we are referring to ZPUino 2.0. The ZAP IDE used ZPUino 1.0 and with DesignLab we upgraded to ZPUino 2.0. It was a little bit at the last minute and I was under a deadline to get DesignLab 1.0 released around the same time that Papilio DUO boards started shipping. There are some really excellent improvements with ZPUino 2.0 that are well worth the upgrade. But unfortunately I didn't have enough time before the DesignLab release had to be done to go through every single sketch and make sure they worked 100% with the ZPUino 2.0 Soft Processor. So it is leading to some growing pains, in a perfect world we would have spent another 2 months testing with ZPUino 2.0 before releasing it. I agonized over the decision to upgrade to 2.0 on such short notice but in the end there were too many important new features to stay with 1.0.

 

So off the top of my head these are the big improvements with ZPUino 2.0, I think Alvie can add to this list:

  • A much improved and easier to use timer library and interrupt library. With ZPUino 1.0 we had to setup the timers manually by setting ZPUino registers. With 2.0 there is a slick new library that lets us just call a function such as periodicHZ() and then tell it what function to call back when the timer is reached. PWM functionality is greatly expanded in 2.0.
  • Automatic detection of Wishbone slots - with ZPUino 2.0 Wishbone peripherals have an ID associated with them and there is a Device class that will automatically determine which Wishbone slot your device is connected to. So for example, if you add one UART to your circuit and do a Serial.begin(9600) in ZPUino 2.0 it doesn't matter if the UART is connected to Wishbone slot 5, 9, 10, or whatever - it will automatically be found. This caused us some issues about how to easily connect to a UART when you have more then one but we have that worked out now.
  • We can also report what peripherals are connected to wishbone slots with ZPUino 2.0 - so we can print out a memory map of what is connected basically.
  • DMA transfers for peripherals like the VGA adapter are greatly expanded and improved.
  • All the coolest peripherals that Alvaro has worked on in the last six months require ZPUino 2.0. If we would have stayed on ZPUino 1.0 then we would not be able to use the awesome new VGA adapter that he just released. Or the RGB LED Panel driver that we are hoping to get released soon, or HDMI output that we hope to release soon. The list goes on and on for what is in the pipeline that require ZPUino 2.0...
  • POSIX support - Alvaro added POSIX support in ZPUino 2.0 which makes it very easy to port cool linux libraries like PNG or JPEG libraries.

 

Hmmm, let me think some more on what is new.

 

Jack.

Share this post


Link to post
Share on other sites

Oh, and I forgot to add that DesignLab works with all of the Papilio boards. So the first release of DesignLab has ZPUino 2.0 for all of the Papilio boards. That is a lot of sketches to go through. :)

 

Jack.

Share this post


Link to post
Share on other sites

If anyone has the AnalogWing, can you please test it out with the AnalogWing example in 1.04 (after modifying the SPIADC.h) per my previous post (#4 above). I don't seem to get any output (zeros across all channels) and I'm not sure if anything changed or if something else went wrong hardware-wise with my wing.

 

Thanks

Share this post


Link to post
Share on other sites

Having seen ruzzmon's comment above I decided to give this example one more try. Previously I have got no further than the error message so I made the suggested change and tried again. This now compiled cleanly ( no errors, plenty of warnings!)  however it still failed to get beyond the first part of the code. By adding print statements I was able to establish that where the interrupts are turned on it never continues. The line that seems to cause the problem is the one that says:-

 

  INTRMASK = BIT(INTRLINE_TIMER0); // Enable Timer0 interrupt

  Serial.println("S2e.");

  INTRCTL=1;     <---- problem line

   Serial.println("S3.");

  //Setup VGA Hello World

The green lines are the prints I added.

 

The output was:-

SmallFS Started.Opening Mod File from SmallFS.4D 2E 4B 2E  Number of patterns: 23Memory needed: 96440Loading sample data ptrAll loadedS2.S2a.S2b.S2c.S2d.S2e.

As can be seen the code stops after the line INTRCTL=1;

 

Now I'm not an expert on Arduino or FPGA but it seems to me that this is trying to enable interrupts. However I cannot find where the interrupted vector is set up.

 

I would appreciate some help in how to debung this problem. I assume it should call the ZPU interrupts routine "_zpu_interrupt" but don't understand how it knows that is the routine to call.

 

I would also like to say that I think the progress in design lab is excellent I have recently purchased a Papilio DUO -2 MB, and the new design lab persuaded me to dig out my older Papilio pro and logicstart megawing whilst waiting for the arrival of the shields that I have ordered.

Yours

Peter D Hull

 

Hello Peter, what sketch are you working with here? It doesn't appear to be the WING_Analog.ino sketch...

 

Jack.

Share this post


Link to post
Share on other sites

If anyone has the AnalogWing, can you please test it out with the AnalogWing example in 1.04 (after modifying the SPIADC.h) per my previous post (#4 above). I don't seem to get any output (zeros across all channels) and I'm not sure if anything changed or if something else went wrong hardware-wise with my wing.

 

Thanks

 

Hello ruzzmon,

 

I can confirm that I'm getting all zeros here as well. There is one more change that needs to be done:

https://github.com/GadgetFactory/DesignLab/commit/24749c728a9bd9d42cac357227b812e6eb4f466b

 

Line 10 of SPIADC.cpp needs to be changed as shown in the commit above. Technically it should be changed to what line 9 shows, but for some reason Device Registration is messing up again so we have to sort that out again before we can make the correct change. Changing it to what is in the commit above will temporarily fix the issue.

 

Jack.

Share this post


Link to post
Share on other sites

Thanks Jack - that seems to have it working again.

 

May I suggest running a few of your examples as a test suite prior to a release. It may help you find and address these problems before we try to report them and will also save us some headaches. 1.04 had an error in SPI code and SPIADC and you have examples for both.

 

Also, I have switched over to Alvie's new VGA adaptor and the results are excellent (Papillio Pro).

 

Thanks

Share this post


Link to post
Share on other sites

Hello Peter, what sketch are you working with here? It doesn't appear to be the WING_Analog.ino sketch...

 

Jack.

No thats the LogicStart Megawing with a Papillio Pro.

Share this post


Link to post
Share on other sites

Thank you for the kind words and support Peter. :)

 

I'll make sure the LogicStart MegaWing sketch is working properly. Then hopefully everything is working as it should be!

 

Jack.

Share this post


Link to post
Share on other sites

Hi guys - is there a workaround for the timers? I wanted to try and use periodicHZ but I see in this thread that it may not be fully functional yet. Is that correct? 

 

In my test code, it looks like my function would get called periodically (didn't check the frequency) but the rest of my program would not execute. It appears to get stuck in setup() right after I initialized the timer.

 

Thanks!

Share this post


Link to post
Share on other sites

Hello ruzzmon,

 

Timers definitely work without any problems. Here is an example:

/* Gadget Factory Zpuino 2.0 Timer Example To learn more about using DesignLab please visit http://learn.gadgetfactory.net Tutorials: Related library documentation: Hardware:    Special Notes: created 2015 by Jack Gassett http://www.gadgetfactory.net  This example code is in the public domain. */#define circuit ZPUino_Vanilla #include <Timer.h> int led = 13;int ledVal = 0; void setup() {  // put your setup code here, to run once:    Serial.begin(9600);    pinMode(led, OUTPUT);      //Setup timer that will generate an interrupt at 1hz  Timers.begin();    int r = Timers.periodicHz(1, timer, 0, 1);    if (r<0) {        Serial.println("Fatal error!");    }     }bool timer(void*){  //1Hz Timer  Serial.println("In Timer");  ledVal = ~ledVal;  digitalWrite(led, ledVal);   return true;}void loop() {}

Share this post


Link to post
Share on other sites

Jack,

 

What can I say but excellent service. I've tried the new version and all seems fine.

 

I understand just how hard what you are doing actually is. Do you get any rest?

 

Now all I need to ask is where do I go to find the documentation for ZPUino 2.0?

 

Once again

Thanks

 

Peter

Share this post


Link to post
Share on other sites

Thanks for the example Jack!

 

I figured out my problem was not the code itself, but rather the frequency of my calls to the timer. Do you or Alvie have an idea of how often we can call the timer? A maximum operation frequency for example? I'd like to use the timer to make calls to write a signal/reconstruct a waveform and so the faster I can call the timer the better. Ideally a step-size of 1µs (1MHz) would be perfect but I can probably deal with 2µs step sizes without issue.

 

Any tips to increase the speed? Your example works up to 1MHz (and probably higher; I tried 2MHz but that didn't work) but my own code, which does some additional processing, tops out at 600kHz (which I think I can make work for me but I want some additional 'buffer' room). For example, I would assume that my code must execute much faster than my minimum step-size and to accomplish this I'd need to optimize my code. Is there anything else than improving my code? Perhaps something like running two timers in parallel, both at 500kHz (assuming I can split my code as such).

 

Thanks for any insight you guys may have and apologies this isn't directly about 1.0.4.

 

 

 

Hello ruzzmon,

 

Timers definitely work without any problems. Here is an example:

Share this post


Link to post
Share on other sites

I can't get the DesignLab 1.0.4 to work, I get the Launch4j error after seeing the splash screen.

The arduino_debug output shows it to be this java/arduino error: https://github.com/arduino/Arduino/issues/2691

Which appears to be fixed via bunding a newer version of java in arduino, as of 19 days ago.

Any possibility you can merge in those changes? It seems to affect people using VMWare, which are probably a lot of your users :)

  • Like 1

Share this post


Link to post
Share on other sites

(In the meantime, anyone using VMWare that can't boot DesignLab -- go into VMWare's sharing settings and turn off sharing. Sharing makes your Windows home folder read-only, which the Arduino version of java doesn't like when it's trying to enumerate the serial devices.)

  • Like 1

Share this post


Link to post
Share on other sites

ruzzmon: Why do you need such speed ? Yes, you can try attaching directly to interrupt vector, but at 1MHz you can only process 96 instructions, add possible icache misses and memory latency... it's rather short.

 

For those speeds, a dedicaded HW controller would be a better approach. Note that you have a direct memory access, so you are not constrained on memory access.

 

Alvie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now