PIC32MZ2048ECG100 SPI Pin are not all avaible

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben
Can you help me a little...
On a board with PIC32MZ2048ECG100 I have to config
SPI2 and SPI3
I think the good thing is on this CPU you can choose for
SPI2 C4 and B3 as MOSI or MISO
SPI3 B10 and B9 as MOSI or MISO
But in FC8 are not all Pins for the SPI avaible.

SPI2.PNG
(16.73 KiB) Downloaded 3995 times
SPI3.PNG
(15.21 KiB) Downloaded 3995 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

Hi Stefan,

I believe this should be fixed now.

Please can you run the Help -> Check for updates tool and get the latest CAL_SPI component and hopefully this should solve the problem for you.

Let us know how you get on.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

It's working perfect. It's nice to have FC8 with the update.

regards

Stefan

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

There is still a little problem.
I can now choose the SPI2 with C4 and B3 as MOSI or MISO.
If I config C4 as MISO and B3 as MOSI then the signal goes out from the PIC but the PIC can not read a signal.
I controlled the Signal with the scope and every thing looks fine on the Pin from the PIC.
When I change the SPI to hardware then it's ok.
There is a problem with C4 as MISO.

Soon I test SPI3......

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

I tested SPI3 with an SD Card and it's ok.
So just the SPI2 Miso on C4 has a problem.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben


There is still a problem with SPI2. The MISO on Pin C4 is not working if I choose hardware SPI. Data is on the pin but the SPI read always 0.
Strangely I can choose C4 ...as MISO...

If I change to software SPI it's reading from C4.

For the part on this SPI bus I need a hardware SPI. It's read 8Channel 24 bit ADC.
Can you give me a hint what I can do to make SPI2 work correctly?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

Hello,

We've just seen this very problem on a 16F18877 and it looks to be a silicone bug. If you change the sample point to the end of the period then it starts working as expected.

You should be able to edit the SPI properties by clicking on View -> Component Debugger to see if it's a similar problem to the one we are seeing.

Tick the Expose full component tree checkbox

Using the drop down at the top of the properties window look for the cal_spi component.

Change the sample point property to End.

Untick the expose full component tree checkbox and close the Component Debugger window.

Let us know how you get on.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

I dit it but no effect.
But I'm not sure if I undestand it right.This option is always in the properties windows.
SPI_on_END.PNG
(100.22 KiB) Downloaded 3853 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

SPI hardware Channel 3 is working fine
SPI hardware Channel 5 is working fine

I can not yet use SPI 2 hardware. So I tried to solder a wire to an another pin, but the same problem.

Mosi= B3; Miso= C4 ;clk= G6 //software ok, hardware no input
Mosi= B3; Miso= D3 ;clk= G6 //software ok, hardware no input

Software SPi is working but the maximal speed is 3.3Mhz

I just copy the info from Texas Instruments about the minimum speed for the TI Chip...
If you take a look at table 7.6 of the datasheet you will see the minimum SCLK period, either 50nS or 66.6nS depending on your DVDD voltage. This corresponds to 20MHz or 15MHz respectively. Your SCLK of 3.3MHz is much too slow.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

I've had a look through the device definition file and the CAL code for SPI 2 vs SPI 3 and the code as far as I can see is correct.

Is there an errata document for this device on the microchip website? I tried to have a look but the documents for the device don't seem to be available atm. Also the device is marked as not for new designs, maybe the EFG version would be better?

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

For the SPI2 MISO with C4 is not working.
I put a wire to all the Pin in the list ... ..
And one is working!

I put a wire from C4 to D3 and changed MISO to D3. Then it's working with the hardware SPI2.
Please can you check if it's in way possible to fix the C4.

The another thing is that leading and trailing edge are reversed in hardware SPI. Not a problem for me......
The picture is choosed leading but it's trailing (it's a value 0x02).
hardware_leading.png
(34.49 KiB) Downloaded 3718 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

Hello,

Please can you post your Flowcode project file just in case there is anything specific in there that is causing additional problems. For example multiple SPI components connected to the same channel.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

Here the program.

This program has some more problems....

1 "slow" MPU9250
viewtopic.php?f=65&t=19436

2 analog input is not working
viewtopic.php?f=76&t=20416

3 eeprom is not working
viewtopic.php?f=76&t=20298

but otherwise works very well with SD card and wireless

regards


Stefan
Attachments
Fc8_ecg test_1.fcfx
(272.99 KiB) Downloaded 145 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

Hi Stefan,

Thanks for the quick response. There's a lot going on in that program! Can we focus on one problem at a time.

Please create a new and very simple program using a single SPI bus component.

Does the remapping work as expected for pin C4 for this?

If not then please post the program and we can look into the problem for you.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben
Does the remapping work as expected for pin C4 for this?
Yes with the Pin C4 it's working but soon I need the pin for the another hardware.

Please create a new and very simple program using a single SPI bus component.
Yes I will do it... :) but how can you look if multiple SPI components connected on the same channel......

I suspect a configuration problem from the SPI2.

Give me a little time and I reduce a lot.... and post it again

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

I connect from an output a restistor to C4 and D3

I wrote a little program.
If the SPI MISO is working then the green led is blinking.

Following result

Hardware D3 blinking
Hardware C4 dark
Software C4 blinking

testoutput.PNG
(8.35 KiB) Downloaded 3648 times
Attachments
Fc8_ecg4matrix.fcfx
(77.24 KiB) Downloaded 106 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

Hello,

You've still got a lot of components in your program, would you mind starting again using a new project and a single SPI master component. This is just to be 100% sure that nothing else is effecting the code generation.
Attachments
Comps.jpg
Comps.jpg (45.58 KiB) Viewed 8335 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben


I did it.

Some Pin I need to set. It's a hardware

The result is the same

Hardware D3 blinking
Hardware C4 dark
Software C4 blinking
Attachments
Fc8_ecg4matrix_reduced.fcfx
(50.66 KiB) Downloaded 111 times

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

I changed the CPU from PIC32MZ2048ECG100 to PIC32MZ2048EFG100

It's the same problem with the config from SPI2 with the MISO C4 (CLOCK G6 and MOSI B3 are ok.)
The C4 is not working as input in hardware SPI2. In software mode it's working but much slower.
Can you have look why its not working in hardware SPI2 as input?
Regards

Stefan

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by stefan.erni »

Hi Ben

I changed the CPU from PIC32MZ2048ECG100 to PIC32MZ2048EFG100
And I tried the same with PIC32MZ2048EFH100 and there the PIN C4 is working on SPI2 as MISO.

So I tried it again with the PIC32MZ2048EFG100 and it's working now there also.
I don't know exactly why. But that's fine

regards

Stefan

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Post by Benj »

Hi Stefan,

That's great news, not sure why but if it's working then we can't grumble too much :D

Thanks for letting me know.

Post Reply