Jump to content
  • 0

Analogshield and ChipKIT Wi-FIRE


adralencar

Question

Does anyone know if AnalogShield will work on the new ChipKit Wi-FIRE (with few modifications) ?

I look inside the library and I saw several " #ifdef __PIC32MX__ "

However the new ChipKit WI-FIRE is " PIC32MZ ", MZ not MX. In other words, without any modification it will not work. However, if the chip is similar, as described in this forum, should be easy.

Thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Hello adralencar,

I moved your post to a new thread since it is a great question.

The library for the analogShield would be easy to modify for the Wi-FIRE.  Simply, replace all of the

      "#if defined (__PIC32MX__)"

with

      "#if defined (__PIC32MX__) || defined (__PIC32MZXX__)".  

and 

      "#if defined (__PIC32MX__) || defined (__SAM3X8E__)"

with

     "#if defined (__PIC32MX__) || defined (__PIC32MZXX__) || defined (__SAM3X8E__)"

I would definitely pull your changes into the master branch, if you update the library for this.

Tell me how it goes.

Marshall

Link to comment
Share on other sites

Thank you Marshall!

Currently I already made my application to run using Chipkit UNO32 and MAX32 (together with AnalogShield). My next step is to test in a Arduino DUE (I already got one).

My application is in scientific research, so I need as much speed as I can get (to increase time resolution). Thus very soon I will buy the Wi-FIRE to test it.

Do you have any suggestion to speed up the SPI transmission (ChipKit to AnalogShield)? In my application, once I reach 500 Hz wave, or above, I start to see time quantization, probable due the SPI speed. I realize that the AnalogShield do not use the buffered DSPI. Any clue?

This is the piece of my current code, which is inside a loop:

          time=micros()-time0; 
          mag_out = -1 + MED_VALUE*(1+sin(pi2_mil* time));
          #ifdef ANALOG_SHIELD
            analog.write(0,MAG_value_out);
          #endif

 

Thank you,

Adriano

 

Link to comment
Share on other sites

I haven't been able to test the latest build of the AnalogShield library on the DUE since I do not have a DUE.  I suspect the DUE will not perform as well as the ChipKIT due to the optimizations in place for PIC32.  Regardless, I would like to know the results.

Unfortunately, I never got around to putting the DSPI library into the ChipKIT part of the library.  If I remember right, the SPI module on the PIC32 can run up to 20MHz.  I do not know what the stock speed is in the SPI library.  

I am surprised that you are seeing distortion at that slow of a speed.  I got the library running about as fast as the ADC and DAC can run on a UC32.  Can you post your entire sketch and I might be able to spot something that might cause the slow down?

Marshall

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...