PIC32MZ2048ECG100 SPI Pin are not all avaible

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

Moderator: Benj

stefan.erni
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Tue Jul 17, 2018 11:43 am

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
SPI2.PNG (16.73 KiB) Viewed 584 times


SPI3.PNG
SPI3.PNG (15.21 KiB) Viewed 584 times

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

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby Benj » Tue Jul 17, 2018 3:34 pm

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Tue Jul 17, 2018 4:13 pm

Hi Ben

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

regards

Stefan
These users thanked the author stefan.erni for the post:
Benj (Tue Jul 17, 2018 4:51 pm)
Rating: 5.88%
 

stefan.erni
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Mon Aug 13, 2018 7:58 am

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Tue Aug 14, 2018 2:41 pm

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Tue Aug 21, 2018 2:09 pm

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: 13265
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 3875 times
Been thanked: 3698 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby Benj » Wed Aug 22, 2018 9:59 am

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Wed Aug 22, 2018 10:54 am

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
SPI_on_END.PNG (100.22 KiB) Viewed 442 times

stefan.erni
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Wed Sep 05, 2018 8:41 am

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: 13265
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 3875 times
Been thanked: 3698 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby Benj » Thu Sep 06, 2018 4:00 pm

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?
These users thanked the author Benj for the post:
stefan.erni (Thu Sep 06, 2018 4:18 pm)
Rating: 5.88%
 

stefan.erni
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Wed Sep 19, 2018 3:02 pm

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
hardware_leading.png (34.49 KiB) Viewed 307 times

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

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby Benj » Tue Sep 25, 2018 2:48 pm

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Tue Sep 25, 2018 3:12 pm

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
(273.1 KiB) Downloaded 6 times

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

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby Benj » Tue Sep 25, 2018 3:26 pm

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Tue Sep 25, 2018 3:41 pm

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
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Wed Sep 26, 2018 8:48 am

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
testoutput.PNG (8.35 KiB) Viewed 237 times
Attachments
Fc8_ecg4matrix.fcfx
(77.35 KiB) Downloaded 5 times

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

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby Benj » Wed Sep 26, 2018 10:59 am

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 234 times

stefan.erni
Posts: 376
Joined: Fri Aug 19, 2016 2:09 pm
Has thanked: 126 times
Been thanked: 107 times
Contact:

Re: PIC32MZ2048ECG100 SPI Pin are not all avaible

Postby stefan.erni » Wed Sep 26, 2018 11:18 am

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 6 times