• AVR Freaks

Hot![Solved:]PIC32MZ2048EFM100 SDCard Not Working

Author
karan123
Super Member
  • Total Posts : 853
  • Reward points : 0
  • Joined: 2009/02/02 11:11:21
  • Location: 0
  • Status: offline
2019/04/24 09:43:04 (permalink)
0

[Solved:]PIC32MZ2048EFM100 SDCard Not Working

Hello,
 
I have my custom boards with PIC32MZ2048EFM144 and PIC32MZ2048EFM100.
LEDs, Switches , Timers, USARTs, USB (MSD) is working fine with both PIC32MZ2048EFM100 and  PIC32MZ2048EFM144,
with  Harmony  V2_04 V2_06.
sdcard_fat_single_disk is working fine with PIC32MZ2048EFM144 (8GB).
But I am struggling to create or porting sdcard_fat_single_disk from PIC32MZ2048EFM144 to PIC32MZ2048EFM100.
 
RG6              >> SCK2
RG7              >>  SDI2
RG8              >> SDO2
RC2        RC1       >> SELECT_LINE_SDCard
Write Protect >> Not Used 
 
I have just change MCU EFM100 . After Generating Code, delete pins which does not exists in 100 Pin Part and then build successfully .
 
I am attaching my project .
What is happening Wrong .? My SDCard card hardware is same . I have also tested by Toggling pines on SDCard Connector .
 
Please Update .. 
Thanks in advance
 
--
Karan
 
post edited by karan123 - 2019/05/03 10:18:28
#1

12 Replies Related Threads

    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/27 01:14:00 (permalink)
    0
    Hi,

    Please Check attachments Harmony Screen shorts and Schematic.
    I am using same SD Card, Working with PIC32MZ2048EFM144 Devicebut not working on PIC32MZ2048EFM100  Device. 
    Is there any issue with SPI2 when using these pins with 100 Pin Device.?
     
    Edited: After Comparing the Signals SDI2 is not as expected in 100 Pin Device and As seen in 144 Pin.

    Thanks in advance.

     Karan
    post edited by karan123 - 2019/04/27 03:01:49

    Attached Image(s)

    #2
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/27 06:54:55 (permalink)
    0
    After Doing Experiments,
    I have choosed PIC32MZ2048EFM144 + BSP of
    sdcard_fat_single_disk project but set pins accordingly 100 pin device and forcefully burn Hex file
    PIC32MZ2048EFM100.
    It Works...

    Is there any bug or What ?
    while Switching 144 pin to 100 pin.?
    What I am missing?


    Please Update

    --
    Karan
    post edited by karan123 - 2019/04/27 09:41:32
    #3
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/28 09:32:33 (permalink)
    0
    Anybody experience same situation?
    #4
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/28 09:32:33 (permalink)
    0
    Anybody experience same situation?
    #5
    Paul PortSol
    Super Member
    • Total Posts : 530
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/29 05:36:23 (permalink)
    0
    Not a solution, but some things you can try:
     
    a) Check errata for the PIC, I've been bitten a few times with both listed and unlisted PIC issues.
    If it turns out to be a hardware issue submit a ticket so errata is updated.
    b) Try a different SPI port.
    c) Check your clocks. What is FNOSC set to? FNOSC may be safest as SPLL, as I had an issue where I had an external Oscillator I wanted to use directly, so set FNOSC=POSC, but that worked only "without" a bootloader, with a bootloader the clocks to my UART peripheral were distorted. So I ran the Osc through the SPLL to bypass issue (ticket submitted). PIC32MZ2048EFM064
    d) Create a fresh minimal project without any history and without BSP just to test this single feature.
    see attached: MHC_CreatingProjectWithoutBSP_v00PR.txt
    In MHC under App add application code Generate a sample app for exactly your PIC32 for SD Card - I find this is better than pre-built apps since it exactly matches your hardware (see file above).
    e) Use "Beyond Compare" to compare your two projects (EFM144/EFM100) and try to catch where the differences could be causing your issue. I have had to patch a few things found this way. If it works please post here and post a ticket so it gets into next Harmony. Sometimes MHC settings can interact or be encoded wrong, and comparing to a working project can catch the wrongly generated code (even when generated in a different version of MHC/Harmony).
     
    Paul
    #6
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/30 01:40:17 (permalink)
    0
    Hi Paul,
     
    Thanks for update..

    a) Check errata for the PIC, I've been bitten a few times with both listed and unlisted PIC issues.
    If it turns out to be a hardware issue submit a ticket so errata is updated.
    b) Try a different SPI port.

    I think above things are OK . Because when I use  BSP of 144 Pins device
    but set SPI2 and  SDCard Select pins according to 100 Devices and
    forcefully burn Hex file PIC32MZ2048EFM100. Luckly it works.
     

    c) Check your clocks. What is FNOSC set to? FNOSC may be safest as SPLL, as I had an issue where I had an external Oscillator I wanted to use directly, so set FNOSC=POSC, but that worked only "without" a bootloader, with a bootloader the clocks to my UART peripheral were distorted. So I ran the Osc through the SPLL to bypass issue (ticket submitted). PIC32MZ2048EFM064

    It might be wrong because my checking on SDI2 signal on scope . It does not comes as expected by changing 100 device .
     

    d) Create a fresh minimal project without any history and without BSP just to test this single feature.
    see attached: MHC_CreatingProjectWithoutBSP_v00PR.txt
    In MHC under App add application code Generate a sample app for exactly your PIC32 for SD Card - I find this is better than pre-built apps since it exactly matches your hardware (see file above).

    Most of MCHP demos comes with BSP  as I see . Is there any link , app note ,  page number ,
    how to create simple application with sdcard and USB MSD which harmony screen shorts from scratch with required modification in app.c and app.h ?

    e) Use "Beyond Compare" to compare your two projects (EFM144/EFM100) and try to catch where the differences could be causing your issue. I have had to patch a few things found this way. If it works please post here and post a ticket so it gets into next Harmony. Sometimes MHC settings can interact or be encoded wrong, and comparing to a working project can catch the wrongly generated code (even when generated in a different version of MHC/Harmony).
     

    I will check with Kdiff 3 Tool then update to you..
     
    Thanks for your time..
     
    --
    Karan
    #7
    Paul PortSol
    Super Member
    • Total Posts : 530
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/30 05:50:05 (permalink)
    0
    Steps to create a clean project with MSD filesystem without BSP
    (I use USB stick but should be very similar for SD Card).
     
    Filesystem_MSD_v01_20190430PR.zip(.docx)
    Useful notes: MHC_CreatingProjectWithoutBSP_v00PR.txt
     
    Paul
     
    #8
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/30 09:11:36 (permalink)
    0
     
    Thanks ... Paul PortSol ..
     
    I have already did this and succeeded for USB MSD but not for SDCard .
     
    Any idea about SPI - SDCard.
    Please find attachment..
     
    --
    Karan
    #9
    Paul PortSol
    Super Member
    • Total Posts : 530
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/04/30 11:44:13 (permalink)
    0
    I've not used SD Card. 
    For SPI check errata and other posts, I believe there may be issues with some SPI ports not working on some PIC32MZ chips, it was a while back.
    #10
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/05/03 10:21:28 (permalink)
    0

    Paul PortSol
    I've not used SD Card. 
    For SPI check errata and other posts, I believe there may be issues with some SPI ports not working on some PIC32MZ chips, it was a while back.

    Now  I am able to PIC32MZ2048EFM100 and sdcard_fat_single_disk project but set pins accordingly device and burn Hex file on same 100-pin device.
    But Not able to run from scratch ..
     
    post edited by karan123 - 2019/05/03 10:23:09
    #11
    Paul PortSol
    Super Member
    • Total Posts : 530
    • Reward points : 0
    • Joined: 2015/07/03 11:52:03
    • Location: Newfoundland, Canada
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/05/03 10:26:29 (permalink)
    0
    Download a free version of "beyond compare" or similar software
    and use it to compare the working and broken project folders to see what files have differences.
     
    Maybe there is a harmony or MHC bug affecting you.
     
    www.scootersoftware.com/download.php
    #12
    karan123
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/02/02 11:11:21
    • Location: 0
    • Status: offline
    Re: PIC32MZ2048EFM100 SDCard Not Working 2019/05/03 10:52:13 (permalink)
    0
    Paul PortSol
    Download a free version of "beyond compare" or similar software
    and use it to compare the working and broken project folders to see what files have differences. 
    Maybe there is a harmony or MHC bug affecting you. 
    www.scootersoftware.com/download.php



    Thanks ..  I have Kdiff3 .
    KDiff3 is a tool for Comparison and Merge of Files and Directories.
    https://kde.org/applications/development/kdiff3/
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5