6240 views|24 replies

76

Posts

0

Resources
The OP
 

PIC32 code is programmed successfully but does not run [Copy link]

 
As the title says, the compiler prompts that the programming is successful, but the program does not run, the MCLR pin is always low, all IO ports are high, and the chip is always in reset state. Is there something wrong?
This post is from Microchip MCU

Latest reply

I also have this microcontroller, and its ID is also A1. I can burn the program into it, but it won't run. I don't know why?   Details Published on 2022-3-2 17:12
 

419

Posts

1

Resources
2
 
Well, first you have to rule out whether it is a hardware problem or a problem with your program configuration.
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
3
 
As for the hardware, it can be programmed correctly, so there should be no problem. During the programming process, I measured the MCLR pin with a voltmeter, and it was correct when it was at a high level. It is probably a configuration problem, but I don't know where the configuration problem is. I didn't go to bed until after 2 o'clock last night.
This post is from Microchip MCU
 
 
 

6366

Posts

4929

Resources
4
 
Check the clock configuration.
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
5
 
Internal FRC used
This post is from Microchip MCU
 
 
 

1w

Posts

16

Resources
6
 
Check whether there is a reset and the configuration of the crystal oscillator. It should be a configuration problem.
This post is from Microchip MCU
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

76

Posts

0

Resources
7
 
The key is why the MCLR pin is always low. Even if it is not configured correctly, the reset is controlled by hardware.
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
8
 
#pragma config FMIIEN = ON // Ethernet RMII/MII Enable (MII Enabled) #pragma config FETHIO = ON // Ethernet I/O Pin Select (Default Ethernet I/O) #pragma config PGL1WAY = ON // Permission Group Lock One Way Configuration (Allow only one reconfiguration) #pragma config PMDL1WAY = ON // Peripheral Module Disable Configuration (Allow only one reconfiguration) #pragma config IOL1WAY = ON // Peripheral Pin Select Configuration (Allow only one reconfiguration) #pragma config FUSBIDIO = ON // USB USBID Selection (Controlled by the USB Module) // DEVCFG2 #pragma config FPLLIDIV = DIV_8 // System PLL Input Divider (8x Divider) #pragma config FPLLRNG = RANGE_34_68_MHZ// System PLL Input Range (34-68 MHz Input) #pragma config FPLLICLK = PLL_FRC // System PLL Input Clock Selection (FRC is input to the System PLL) #pragma config FPLLMULT = MUL_128 // System PLL Multiplier (PLL Multiply by 128) #pragma config FPLLODIV = DIV_32 // System PLL Output Clock Divider (32x Divider) #pragma config UPLLFSEL = FREQ_24MHZ // USB PLL Input Frequency Selection (USB PLL input is 24 MHz) // DEVCFG1 #pragma config FNOSC = FRCDIV // Oscillator Selection Bits (Fast RC Osc w/Div-by-N (FRCDIV)) #pragma config DMTINTV = WIN_127_128 // DMT Count Window Interval (Window/Interval value is 127/128 counter value) #pragma config FSOSCEN = OFF // Secondary Oscillator Enable (Enable SOSC) #pragma config IESO = ON // Internal/External Switch Over (Enabled) #pragma config POSCMOD = OFF // Primary Oscillator Configuration (Primary osc disabled) #pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin (Disabled) #pragma config FCKSM = 0//CSECME // Clock Switching and Monitor Selection (Clock Switch Enabled, FSCM Enabled) #pragma config WDTPS = PS1048576 // Watchdog Timer Postscaler (1:1048576) #pragma config WDTSPGM = STOP // Watchdog Timer Stop During Flash Programming (WDT stops during Flash programming) #pragma config WINDIS = NORMAL // Watchdog Timer Window Mode (Watchdog Timer is in non-Window mode) #pragma config FWDTEN = 0//OFF // Watchdog Timer Enable (WDT Disabled) #pragma config FWDTWINSZ = WINSZ_25 // Watchdog Timer Window Size (Window size is 25%) #pragma config DMTCNT = DMT31 // Deadman Timer Count Selection (2^31 (2147483648)) #pragma config FDMTEN = 0//OFF // Deadman Timer Enable (Deadman Timer is enabled) // DEVCFG0 #pragma config DEBUG = OFF // Background Debugger Enable (Debugger is enabled) #pragma config JTAGEN = OFF // JTAG Enable (JTAG Disabled) #pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select (Communicate on PGEC1/PGED1) #pragma config TRCEN = OFF // Trace Enable (Trace features in the CPU are enabled ) #pragma config BOOTISA = 0//MIPS32 // Boot ISA Selection (Boot code and Exception code is MIPS32) #pragma config FECCCON = OFF_UNLOCKED // Dynamic Flash ECC Configuration (ECC and Dynamic ECC are disabled (ECCCON bits are writable)) #pragma config FSLEEP = OFF // Flash Sleep Mode (Flash is powered down when the device is in Sleep mode) #pragma config DBGPER = PG_ALL // Debug Mode CPU Access Permission (Allow CPU access to all permission regions) #pragma config SMCLR = 0//MCLR_POR // Soft Master Clear Enable bit (MCLR pin generates a normal system Reset) #pragma config SOSCGAIN = GAIN_2X // Secondary Oscillator Gain Control bits (2x gain setting) #pragma config SOSCBOOST = ON // Secondary Oscillator Boost Kick Start Enable bit (Boost the kick start of the oscillator) #pragma config POSCGAIN = GAIN_2X // Primary Oscillator Gain Control bits (2x gain setting) #pragma config POSCBOOST = ON // Primary Oscillator Boost Kick Start Enable bit (Boost the kick start of the oscillator) #pragma config EJTAGBEN = NORMAL // EJTAG Boot (Normal EJTAG functionality ) // DEVCP0 #pragma config CP = OFF // Code Protect (Protection Disabled) #includeoscillator) #pragma config POSCGAIN = GAIN_2X // Primary Oscillator Gain Control bits (2x gain setting) #pragma config POSCBOOST = ON // Primary Oscillator Boost Kick Start Enable bit (Boost the kick start of the oscillator) #pragma config EJTAGBEN = NORMAL // EJTAG Boot (Normal EJTAG functionality) // DEVCP0 #pragma config CP = OFF // Code Protect (Protection Disabled) #includeoscillator) #pragma config POSCGAIN = GAIN_2X // Primary Oscillator Gain Control bits (2x gain setting) #pragma config POSCBOOST = ON // Primary Oscillator Boost Kick Start Enable bit (Boost the kick start of the oscillator) #pragma config EJTAGBEN = NORMAL // EJTAG Boot (Normal EJTAG functionality) // DEVCP0 #pragma config CP = OFF // Code Protect (Protection Disabled) #include
The above is the configuration code, using the internal FRC
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
9
 
Watchdog and program monitoring timers are turned off
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
10
 

This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
11
 
The above is my download and reset circuit. I have used this circuit before with DSPIC and it worked fine.
This post is from Microchip MCU
 
 
 

327

Posts

0

Resources
12
 
Check the hardware
This post is from Microchip MCU
 
Personal signature学习永无止境
 
 

76

Posts

0

Resources
13
 
After checking and re-soldering the chip, the problem remains
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
14
 
I checked the power supply ripple with an oscilloscope and it was normal.
This post is from Microchip MCU

Comments

Reset, crystal oscillator, power supply, check welding. Measure the waveform. Try another normal program.  Details Published on 2018-2-5 16:58
 
 
 

3471

Posts

11

Resources
15
 
asdmaill posted on 2018-2-5 16:32 I used an oscilloscope to check the power supply ripple and other things, and they are all normal
Reset, crystal oscillator, power supply, check the welding. Measure the waveform. Try another normal program.
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
16
 
I made the board myself. Now the test code is just written and I am ready to test the board.
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
17
 
Why is the MCLR pin always at a low level? When the code is burned, it is correct and can be pulled to 3.3V. After burning, MCLR is always at a low level.
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
18
 
I disconnected the power supply, and IPE prompted the target to be removed. When I connected the power supply, IPE prompted the target to be found, and then displayed the device ID version number A1
This post is from Microchip MCU
 
 
 

76

Posts

0

Resources
19
 
Therefore, I think there is no problem with the hardware, but a configuration problem. It should be that the configuration registers of DEVCFG are not configured correctly, but I don't know which bit is not configured correctly
This post is from Microchip MCU
 
 
 

721

Posts

1

Resources
20
 
The configuration bits only configure the clock and ICSP pins, and the others should remain at default. If it is really necessary, it is recommended to remove SW1 and C2 and directly pull MCLR high with a resistor.
This post is from Microchip MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list