• AVR Freaks

Hot!PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3

Author
KevinHuang
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2019/08/29 08:13:33
  • Location: 0
  • Status: offline
2019/10/17 09:59:11 (permalink)
0

PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3

Hi PIC experts,
My code can run with DM320007 (PIC32MZ2048EFH144-I/PH start kit) without any problem.
Project task: SPI reading and UDP output.
Firmware A running at DM320007, no issue. I'm using my SPI driver(Enhance mode with FIFO), with some modification based on demo project:
                                  C:\microchip\harmony\v2_06\apps\tcpip\berkeley_udp_server
 
I create my PCB with PIC32MZ2048EFH144-I/PH and LAN8740 only. Those parts of my PCB are exactly same as the DM320007 (Ethernet pins; SPI1 are RF5/RF4/RD1, chip select is a GPIO RD10)
 
To fit my PCB, I removed debug/command/console related things from the project through Harmony. Program my PCB with ICD3 through MPLAB X IDE.
This firmware B runs not good. I found out that sometime the data sequence I read from the SPI is not correct. Example, I suppose to read 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12; turns out some time I get 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4; or 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6.   (Feels the SPI FIFO is not read in the right sequence sometime)
Then I put the firmware B (same project, but set hardware tools as PKOB) to the DM320007 (programmed through start kit's PKOB), and this firmware B is running at the DM320007 without any problem.
 
Any suggestions? Thanks your help in advance!
 
Bests,
Kevin
 
 
#1

7 Replies Related Threads

    KevinHuang
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2019/08/29 08:13:33
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/17 10:20:40 (permalink)
    0
    The software: MPLAB X IDE v5.05. 
    Harmony: v2_06
    #2
    KevinHuang
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2019/08/29 08:13:33
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/17 15:25:48 (permalink)
    0
    After remove those unrelated chips (PKOB and so on), the DM320007 is still working fine. Then looks that must be my PCB trace layout issue.
    Thanks for your attention, I will try to find out the DM320007's layout file.
    #3
    ncrews
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2019/08/12 13:50:13
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/18 07:26:11 (permalink)
    0
    Are you still asking a question, or are you saying that you think it's just a PCB design problem you need to search out? In my experience with the Enhanced SPI FIFO (I'm using the PIC32MZ2048EFM144), it is strong. Because you aren't out of sequence exactly, but just looping, that suggests to me that your read is not synchronized with the writing to the FIFO by the hardware. Could it be that your SPI clock is slipping a little, or that you are reading on the in the wrong place (rising edge vs middle vs falling edge) in the clock timing?
    #4
    KevinHuang
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2019/08/29 08:13:33
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/18 07:40:41 (permalink)
    0
    Ncrews,
     
    Thanks for  your attention. Based on our analyse, the FIFO should be fine.
    Yesterday I modified my code to use the standard mode, no FIFO, and read byte by byte, still same problem. Which means not the FIFO problem.(My side is master). Yes to my understanding, the slave side has problem, but I can not modify the slave side; the only thing I can do is let the master side to cooperate with the slave side  --- since with the Evaluation board DM320007 the slave can work, then there is no excuse that my PCB can not to do it.
    That's why I want to get the evaluation board's layout: https://www.microchip.com/forums/m1115734.aspx
     
     
    If you were taking about the clock slipping, that also may happen, but not our case. The SPI clock slipping may lead to wrong data bytes, not swap of the bytes' sequence. (example I want to get 0x10, but I get 0x08, this should be your suggestion.)
     
    Bests,
    --- Kevin
     
    #5
    KevinHuang
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2019/08/29 08:13:33
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/18 14:54:47 (permalink)
    0
    Problem solved. The wires on the DM320007 have Parasitic capacitance, but my PCB doesn't. 47pF capacitor added, and now problem solved.
    Thanks for your reading.
    #6
    ncrews
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2019/08/12 13:50:13
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/22 15:19:17 (permalink)
    0
    You discovered that quick. I'm impressed!
    #7
    KevinHuang
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2019/08/29 08:13:33
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFH144 compiled/programmed with start kit VS compiled/programmed with CD3 2019/10/22 15:42:45 (permalink)
    0
    Ncrews, yes, my SPI function is running at 33.3MHz, and I found that the SPI is very sensitive about lots of things at this frequency.
    Thanks for your reading. 
    post edited by KevinHuang - 2019/10/22 15:43:51
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5