Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:36 03 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : pic32MZ board 200Mips ( sn-7x )

Author Message
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 04:45pm 08 Oct 2016
Copy link to clipboard 
Print this post

As something of an experiment, I modified my 100 pin pic32 sn-5x board,
to suit the pic32MZ pattern, as a pathfinder, but expected major changes
would be needed before it would be ok. It was rushed as I had to concentrate
elsewhere for a while.

BUT it is programming with a pickit3
and now running at 200 MHz (ed) (albeit with a simple Harmony led flasher) so far.
So the question is now, what software direction do you think ? Anyone with recent
experience of Harmony ? C++ perhaps? PLIB news ?Edited by chronic 2016-10-10
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 12:38pm 04 Nov 2016
Copy link to clipboard 
Print this post

Jeeeez the MZ chips are fast. I put in a temporary delay as a checkpoint..
with ca. a hundred million increments -

(from memory) eg

i = 0 ;
while ( i < 100000000 ) i++ ;

extra time : about a second.

Edited by chronic 2016-11-05
 
akashh
Senior Member

Joined: 19/01/2014
Location: India
Posts: 115
Posted: 03:40pm 04 Nov 2016
Copy link to clipboard 
Print this post

The pic32mz without harmony seems to be the way people with legacy applications are dealing with things, because unless you are using the microchip platform for the first time, it's way of working is so different that it would require a rewrite of much of the code,
Some people on this forum have been working on writing a plib like replacement for the most common functions.
The one thing I have been struggling with on the MZ is the USB stack without harmony, I have not found sufficient documentation to be able to write it from scratch and there is clearly no way the old stack can just be tweaked without a deeper understanding of the registers. If anyone else has made any progress on that and is willing to share that would be great!Edited by akashh 2016-11-06
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 10:03pm 04 Nov 2016
Copy link to clipboard 
Print this post

  Quote  and now running at 200 MHz


If you are running at 200MHz you are using the internal oscillator. The maximum with a crystal that is compatible with USB (only 12MHz or 24MHz) is 198MHz (already made that mistake myself )

  Quote  The one thing I have been struggling with on the MZ is the USB stack without harmony


It seems pretty much impossible to use USB without Harmony. The MZ also has a new ADC and Microchip have published register level code showing how to use it but nothing similar exists for USB as far as I can find.

It is however possible to use just a minimum shell of Harmony for USB and chip initialisation and then code plib style for everything else.

The other gotcha is with the MZs hardware FPU. To get this to work properly you need to include "-fno-short-double" in the compiler options (v1.42) and tick the "use legacy libc" checkbox in the "XC32(Global Options)", otherwise floating point calculations will give the wrong answer.
Edited by matherp 2016-11-06
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3661
Posted: 11:07pm 04 Nov 2016
Copy link to clipboard 
Print this post

Could one of the non-Mchp USB implementations be used (such as mstack)?

Also, I see a lot of complaints scattered across the net about how awful Harmony is so maybe there's a place for a community-produced replacement plib?

Does anyone even have a tiny non-Harmony sample that can just be built, flashed in and run? Flashing a LED or whatever.

I've got a board but it's scrap right now as I'm not going to use Harmony.

John
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 11:20pm 04 Nov 2016
Copy link to clipboard 
Print this post

  Quote  Could one of the non-Mchp USB implementations be used (such as mstack)?


No, this hits the registers direct and the USB hardware on the MZ is completely different from anything that went before.

  Quote  Does anyone even have a tiny non-Harmony sample that can just be built, flashed in and run?


The big issue is configuring and initialising the chip. Just use Harmony for this and then you can write everything else as normal. The latest non-beta release of Harmony is 1.09 and I've found it works very well for this sort of limited use.
 
akashh
Senior Member

Joined: 19/01/2014
Location: India
Posts: 115
Posted: 11:28pm 04 Nov 2016
Copy link to clipboard 
Print this post

The FreeRTOS site has a good sample that's non-harmony and gets everything running properly with multiple flashing LEDs. They have versions for the MZ EC and EF. I based my application off of that.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3661
Posted: 01:15am 05 Nov 2016
Copy link to clipboard 
Print this post

I didn't know FreeRTOS worked on the MZ so thanks!

John
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 03:14am 05 Nov 2016
Copy link to clipboard 
Print this post

Well spotted matherp - only tried the non-crystal osc so far.
I am trying the beta release 2.01b. There is a new configurator 2.01b which looks ok and includes the PPS, there are extensive help descriptions for the system config items which is good. (I admit I am surprised), so far so good, generally there is a steep learning curve though. It seems to be making sense more - maybe I should worry .
(ed) I think 2.01 changes the FPU handling - not sure yet.Edited by chronic 2016-11-06
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 09:57am 05 Nov 2016
Copy link to clipboard 
Print this post

@chronic

Looks like big step ahead. More computing power and largest memory for almost same $.
Well done.

Bo
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 10:35am 15 Nov 2016
Copy link to clipboard 
Print this post

[Grateful for all comments and encouragement - Thanks !! ]

I have now tried the board as a base for trying my small interpreter on the MZ.
The general C code runs virtually unchanged from MX to MZ, a nice thing.
There are tweaks to use a Harmony based interface of course. So far I am able to get a small program into ram, list it, and run it eg


Electride 2.0
PIC32MZ EF

G, S, R, L ?

G
Get..

Electride 2.0
PIC32MZ EF

G, S, R, L ?

L
PROGRAM temperaturedouble
C
DOUBLE celsius, fahr, step
INTEGER*4 i
FORMAT (2F6.4,/)
step = 20.0
fahr = 0.0
DO 10 i = 1, 11
fahr = fahr + step
celsius = 5.0 * ( fahr - 32.0 ) / 9.0
WRITE (6,0) fahr, celsius
10 CONTINUE
END
\
Electride 2.0
PIC32MZ EF

G, S, R, L ?

R
Run..

...

20.0000 -6.6667
40.0000 4.4444
60.0000 15.5556
80.0000 26.6667
100.0000 37.7778
120.0000 48.8889
140.0000 60.0000
160.0000 71.1111
180.0000 82.2222
200.0000 93.3333
220.0000 104.4444




[I was/am working on the formatted floating point I/O so this was to
check rounding in dp as well]. I still have look at the ADC and eeprom yet.

Some of the ic I/O pins on the board were not in the same sequence
as the chip so I have updated that for the revised version. Also the initial regulator gets fairly hot at 12v so it would be good to increase the heatsinking I think, or perhaps use a 220 case type on metalwork somewhere.


 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 03:41am 19 Nov 2016
Copy link to clipboard 
Print this post

What is Harmony?
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3661
Posted: 03:49am 19 Nov 2016
Copy link to clipboard 
Print this post

A kind of dog's dinner / over-engineered pile of ****

http://www.microchip.com/mplab/mplab-harmony

John
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 09:49am 19 Nov 2016
Copy link to clipboard 
Print this post

Please use a different thread for discussion on Harmony ?
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 10:48am 19 Nov 2016
Copy link to clipboard 
Print this post

I didn't/don't want to discuss it, I was just wondering what it was - as in was it part of the pic32MZ or needed*
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 08:32pm 19 Nov 2016
Copy link to clipboard 
Print this post

Well, I can report that the board is running fine.
IE (using ports E,D,F) A connected DS3234 clock (spi
variant of DS3231) gives correct time, the
f77 solar position calculations return correct results
and a little 16x2 lcd updates nicely. There is no sign
of instability or other problems so far.

Incidentally the DS3234 has only drifted ten seconds
in a year...impressive.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 11:57pm 19 Nov 2016
Copy link to clipboard 
Print this post

  Quote  solar position calculations


Would it be possible to post the code. I'd like to test the new double precision calculations in the Micromite Extreme with something proper

Thanks
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 11:13am 20 Nov 2016
Copy link to clipboard 
Print this post

They are not in Basic. I think cdeagle converted some of his
high-precision programs to Basic versions, maybe give those a try.
Calculating the distance between two geodesic points to a high precision is a
useful exercise - the result can be checked against a variety of sources and ultimately with cdeagle's exact version
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 02:10pm 22 Nov 2016
Copy link to clipboard 
Print this post

Now I think about it a bit more, I think main versions of Basic (Liberty Basic and Microsoft Basic I think ? ) had double precision etc so there were some astronomical programs, I don't remember the names though, sorry. Some other versions used iterative methods specifically to bypass low precision errors.

There are many test programs around but they tend to test specific math accuracy
instead of the overall handing. I'm not sure what datatypes the new
versions of MMbasic have - I guess , a 64 bit integer and
a 64 bit floating point ? - but if there is a mix of floating point types,
the nature of C compilers is to go with the flow


 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 03:44am 16 Dec 2016
Copy link to clipboard 
Print this post

(edited) sorry - posted in error

anyway..
this is a test to see what simple png schematics display like..
eg sn-7x board overview :









Edited by chronic 2016-12-22
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024