PIC32-EMZ64 Christmas tree lights ?

Started by KeesZagers, March 15, 2016, 02:02:42 PM

Previous topic - Next topic

KeesZagers

I was at the Embedded World and received my free PIC32-EMZ64. Very nice and very compact. And indeed powering it gave nice random LEDs burning and a horizontal and vertical line moving over the OLED display. I even had some control over the LEDs by some buttons. I'm now wondering if I have to wait until Christmas to hang it in the tree or if I can get some links on the Internet concerning the schematics and the software to start something a bit earlier with this module.

Kees

kyrk.5

Same for me! :) I was even thinking on to start to reverse-engineer the PIN-out. So that I am able to do some basic stuff.

Without any schematic I have just created a dummy empty project to see if the development tools are working. I was used to MPLAB 8.88, so i had to install MPLAB X (still I hate it, because it is so slow for me). Also a new compiler XC32 1.4. Here I encountered no problem. :)
Then creating the empty project was quite funny, since the old plib stuffs are not supported for MZ. Harmony I do not want to have. I am quite home at low levels so using the peripherals is no problem. Finally I have got my system configured and running with 1ms interrupt. Normally I have a big endless loop which is polling if something have to be done (usually 1ms trigger). Starting an empty project gives a big number of loop cycles per sec for this while (1), and later filling the project decrease it. In the first it is decreasing quite fast, then it settles. So now for the empty project I have got around 2,6million runs of the while (1) in 1 sec.
Flashing and Debugging was ok with ICD3.

Now really, I am interested on the schematics because I want to try out an mp3 implementation, and as far as I have seen there are some audio input and output. I really hope that they are on a PWM line so I can do the whole stuff in the PIC32, even the sound generating. And the CAN could be also interesting! I wonder if the SD Card is connected to the SQI module. Because SDIO mode would also be intresting.

Heinz

I'm too interested in the schematics. And I'm waiting for the LiteBSD to be ready to use for this board. This will enable me to start working on the can4linux driver for the PIC32 and LiteBSD.

kyrk.5

I was waiting hoping that at least the schematics will be shared. But nothing, maybe tomorrow? :)

So i started to reverse engineer the pinout from the PCB. I only did the UEXT connector, it was quite easy accessible, and is basically a point to point connection network. I was able to find everything, and wrote also a small test project to drive each pin (selectable) with 1kHz to see if I really catches the right pin. I only had with one pin trouble: UEXT 4 RX. On this pin I did not measured the 1kHz signal, only very short spikes. I think this could be ok since there is a diode and resistor network.

So here is the pinout so far:

PIC32 PIN   PIC32                                       Olimex Board
                                                   UEXT 1 3V3         
                                                   UEXT 2 GND         
52         RD4      SQICS0/RPD4/PMWR/RD4                     UEXT 3 TX      *
46         RD0      AERXD1/ETXD3/RPD0/RTCC/INT0/RD0               UEXT 4 RX      Strange glitch is measured only.
6         RG8      AN12/C2IND/RPG8/SCL4/PMA3/RG8               UEXT 5 SCL       *   
5         RG7      AN13/C1INC/RPG7/SDA4/PMA4/RG7               UEXT 6 SDA      *   
45         RD11   AERXCLK/AEREFCLK/ECRS/RPD11/PMCS1/PMA14/RD11   UEXT 7 MISO      *
53         RD5      SQICS1/RPD5/PMRD/RD5                     UEXT 8 MOSI      *
44         RD10   ECOL/RPD10/SCL1/SCK4/RD10                  UEXT 9 SCK      *
43         RD9      AERXD0/ETXD2/RPD9/SDA1/PMCS2/PMA15/RD9         UEXT 10 CS      *



I think next day I will continue with the Buttons and LEDs. They are also quite easy to measure and verify. Then the Audio part, I am correct this should be only 5 signals, so also not a big effort.

The ethernet seems to be a problem, since they are boot SMDs and of course placed on two different sides. So I can not place the board so easy on my desk. This will be the last one I think.

olimex

Hi
really not necessary to reverse engineering this PCB :)
the web page will be set today, just we had too many things to take care of after the Embedded World and we ran out of man power!

kyrk.5

I think this is Murphys law. If you start to reverse engineer the board you can be sure that on the next day it will be put on the web site. :) So I think it was worth the work :)

KeesZagers

Thank you Kyrk.5 (for reverse engineering and stimulation) and Olimex for starting up the product. I hope you will also publish the existing demo program and the to be used environment of Microchip.

Kees

LubOlimex

Hey guys,

The resources are available at this web-page: https://www.olimex.com/Products/PIC/Development/PIC32-EMZ64/

Each of the demo examples has a README.txt file inside.

Excuse us for the delay and best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

kyrk.5

Cool :)

I already started to build an mp3 player based on the Helix MP3 decoder. I hope I can utilize the PWM output for sound generating.

kyrk.5

The Helix MP3 decoder works :)

I managed to get the MP3 playback working on this uC. But! There is always a but. I did not use any SD Card, instead I put the MP3 file in a C byte array and placed it in the flash. This way I did not had to add a FAT stack and SD Card driver. Sound generating is working with the PWM output. Here I use a 20uS timer interrupt to update the PWM output duty cycle. Since the 20uS gives a different sample rate than the decoded mp3, I do here a kind of re-sampling. Maybe not the cleanest way, since I only count the time and check if the original sampling rate would provide a new sample. The PWM Period is somewhere around 48KHz. I got 11 bit of resolution. Not 16 bit but more than 8 bit. Sounds fine.
I think the cut off freq from the Analog filter on the PCB is somewhere around 30kHz. So the PWM with 48kHz should be fine. Could be more but then the resolution will be to small.

ToDo-s:
- Change 20uS timer so that it is already matching the sampling rate of the decoded mp3. This way some calculation can be spared in the interrupt.
- If possible remove the timer and try to use the module with DMA. Hope this is even possible.
- Add SD Card. And hope very strong that there is enough CPU power, because with the current interrupt based sound generation had lot of lags before I did some optimization.

I hope really that the 200MHz PIC is able to decode the mp3 and create sound with the PWM output while doing some other stuffs also (+tcp +webradio). Lets see :)

KeesZagers

Great, now we have already Christmas lights and playing "Jingle Bells" :-)

For me it would be interesting to copy a lot of the CAN utilities I made for the Duinomite to this hardware. I'm still using the old MPLAB X and as far as I have seen the existing software for this module has been made using Harmony. I have not used that and I'm wondering how compatible the environments are.

Anyway I think it is better to close this "Christmas lights" discussion, because it is clear: the module has become a real universal product.

JohnS

If "Harmony" is the answer.... what was the question?

John
(I think it was: how can we make something truly horrible?)

YankGee

#12
hi..i also worked on this type of project. Creating the empty project was quite funny, since the old plib stuffs are not supported for MZ. Harmony I do not want to have. I am quite home at low levels so using the peripherals is no problem. Finally I have got my system configured and running with 1ms interrupt. Normally I have a big endless loop which is polling if something have to be done (usually 1ms trigger). Starting an empty project gives a big number of loop cycles per sec for this while (1), and later filling the project decrease it. In the first it is decreasing quite fast, then it settles. So now for the empty project I have got around 2,6million runs of the while (1) in 1 sec.
Flashing and Debugging was ok with ICD3.

board+assembly

JohnS

In case you are willing, I expect people would be grateful for your code and how to build it, and so on.

Anything without Harmony may help others also to avoid it!

John

KeesZagers

Nice that the "Christmas lights" have light up again :-)

As I understand at least a few guys succeeded in programming the MZ without Harmony. I also tried to copy some code from the MX to the MZ, but I ran into a problem.

As the CAN driver from Microchip is really buggy (also for the MX controllers), I programmed my CAN software, using direct memory access to the CAN registers in the controller (e.g. *(unsigned long *) (0xBF88B000) to read or write the CAN CONTROL register).

Using the new MPLAB-X and C32 compiler for the MZ, this seems not to be possible anymore. I was thinking this has to do with the MMU in the MZ controller. Am I correct in here and is there a possiblity to access the registers anyway?

Kees