Can't program my PIC32MM0256GPM048

Thread Starter

Aureb

Joined Apr 18, 2019
6
Hello everyone,

I'm having a problem trying to program my PIC32 with the simplest code I can...
I just want to start using it but it doesn't work, the device is programming but the code is not doing what I want.
I just try to put 2 pins (RA4 & RB4) on High level.

Code:
#include <xc.h>


int main(void) {
    TRISA = 0x00;
    TRISB = 0x00;
    PORTA = 0x00;
    PORTB = 0X00;
   
    while(1){
        LATA = 0x10;
        LATB = 0x10;
    }
}
Could anyone help me, am I doing something wrong here ?
 

nsaspook

Joined Aug 27, 2009
9,991
I am using the MPLAB X IDE and program through an ICD3.
I have the 48 pins, 258 Kb of programming memory and 32 Kb of Data memory.
The chip is on a home board because the PIC32 is used to control an audio speaker.
Check the clock , pin and other configuration options to be sure they are correct for your board.
 

Thread Starter

Aureb

Joined Apr 18, 2019
6
I tried configurating using the Microchip Configuration Code.
I have some building errors, would you know what they are related to ?
Code:
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017C4' will not fit in region `config_BFC017C4'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017C8' will not fit in region `config_BFC017C8'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017CC' will not fit in region `config_BFC017CC'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017D0' will not fit in region `config_BFC017D0'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017D4' will not fit in region `config_BFC017D4'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017D8' will not fit in region `config_BFC017D8'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: Link terminated due to previous error(s).
collect2.exe: error: ld returned 255 exit status
make[2]: *** [dist/NORMAL_OP/production/TCF-LPP.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 5s)
It seems to be the XC32 compiler that is having trouble with some configurations.
How could I fix that ?
 

nsaspook

Joined Aug 27, 2009
9,991
Not using windows but it works for me with this simple config from MPLAB X 5.15

mplabx project package: ACC.zip

C:
/**
  Generated main.c file from MPLAB Code Configurator

  @Company
    Microchip Technology Inc.

  @File Name
    main.c

  @Summary
    This is the generated main.c using PIC24 / dsPIC33 / PIC32MM MCUs.

  @Description
    This source file provides main entry point for system intialization and application code development.
    Generation Information :
    Product Revision  :  PIC24 / dsPIC33 / PIC32MM MCUs - 1.95-b-SNAPSHOT
    Device            :  PIC32MM0256GPM048
    The generated drivers are tested against the following:
    Compiler          :  XC16 v1.36
    MPLAB               :  MPLAB X v5.10
*/

/*
    (c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
    software and any derivatives exclusively with Microchip products.

    THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
    EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
    WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
    PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
    WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.

    IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
    INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
    WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
    BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
    FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
    ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
    THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.

    MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
    TERMS.
*/

/**
  Section: Included Files
*/
#include "mcc_generated_files/system.h"

/*
            Main application
*/
int main(void)
{
    // initialize the device
    SYSTEM_Initialize();
    TRISA = 0x00;
    TRISB = 0x00;
    PORTA = 0x00;
    PORTB = 0X00;
    while (1) {
        // Add your application code
        LATA = 0x10;
        LATB = 0x10;
    }
    return 1;
}
/**
End of File
*/
Code:
CLEAN SUCCESSFUL (total time: 51ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory '/root/MPLABXProjects/ACC.X'
make  -f nbproject/Makefile-default.mk dist/default/production/ACC.X.production.hex
make[2]: Entering directory '/root/MPLABXProjects/ACC.X'
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/main.o.d -o build/default/production/main.o main.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/mcc_generated_files/interrupt_manager.o.d -o build/default/production/mcc_generated_files/interrupt_manager.o mcc_generated_files/interrupt_manager.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/mcc_generated_files/exceptions.o.d -o build/default/production/mcc_generated_files/exceptions.o mcc_generated_files/exceptions.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/mcc_generated_files/pin_manager.o.d -o build/default/production/mcc_generated_files/pin_manager.o mcc_generated_files/pin_manager.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/mcc_generated_files/clock.o.d -o build/default/production/mcc_generated_files/clock.o mcc_generated_files/clock.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/mcc_generated_files/mcc.o.d -o build/default/production/mcc_generated_files/mcc.o mcc_generated_files/mcc.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc" -g -x c -c -mprocessor=32MM0256GPM048 -MMD -MF build/default/production/mcc_generated_files/system.o.d -o build/default/production/mcc_generated_files/system.o mcc_generated_files/system.c -DXPRJ_default=default -legacy-libc
"/opt/microchip/xc32/v2.15/bin/xc32-gcc"   -mprocessor=32MM0256GPM048  -o dist/default/production/ACC.X.production.elf build/default/production/main.o build/default/production/mcc_generated_files/system.o build/default/production/mcc_generated_files/clock.o build/default/production/mcc_generated_files/exceptions.o build/default/production/mcc_generated_files/interrupt_manager.o build/default/production/mcc_generated_files/mcc.o build/default/production/mcc_generated_files/pin_manager.o          -DXPRJ_default=default  -legacy-libc    -Wl,--defsym=__MPLAB_BUILD=1,--no-code-in-dinit,--no-dinit-in-serial-mem,-Map="dist/default/production/ACC.X.production.map",--memorysummary,dist/default/production/memoryfile.xml
"/opt/microchip/xc32/v2.15/bin"/xc32-bin2hex dist/default/production/ACC.X.production.elf
make[2]: Leaving directory '/root/MPLABXProjects/ACC.X'
make[1]: Leaving directory '/root/MPLABXProjects/ACC.X'

BUILD SUCCESSFUL (total time: 1s)
Loading code from /root/MPLABXProjects/ACC.X/dist/default/production/ACC.X.production.hex...
Loading completed
 

Attachments

Ian Rogers

Joined Dec 12, 2012
996
I tried configurating using the Microchip Configuration Code.
I have some building errors, would you know what they are related to ?
Code:
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017C4' will not fit in region `config_BFC017C4'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017C8' will not fit in region `config_BFC017C8'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017CC' will not fit in region `config_BFC017CC'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017D0' will not fit in region `config_BFC017D0'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017D4' will not fit in region `config_BFC017D4'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: dist/NORMAL_OP/production/TCF-LPP.X.production.elf section `.config_BFC017D8' will not fit in region `config_BFC017D8'
c:\program files (x86)\microchip\xc32\v2.10\bin\bin\gcc\pic32mx\4.8.3\..\..\..\..\bin/pic32m-ld.exe: Link terminated due to previous error(s).
collect2.exe: error: ld returned 255 exit status
make[2]: *** [dist/NORMAL_OP/production/TCF-LPP.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 5s)
It seems to be the XC32 compiler that is having trouble with some configurations.
How could I fix that ?
It would seem you have the MX series selected... You need to compile for the MM series...
 

Thread Starter

Aureb

Joined Apr 18, 2019
6
I fixed the building problems by creating a new project and it had been correctly flashed to the PIC32.
Thank you a lot for your help
 
Top