Hot!PIC32MK PIM on an Explorer 16/32 Board

Author
Aaron Hancock
Junior Member
  • Total Posts : 87
  • Reward points : 0
  • Joined: 2016/02/23 15:10:25
  • Location: Virginia, USA
  • Status: offline
2018/05/10 10:20:51 (permalink)
0

PIC32MK PIM on an Explorer 16/32 Board

PIC32MK1024MCF100, Harmony 2.05, XC32 2.05
 
A new project will use the PIC32MK1024MCF100 on a custom board.  This MK just happens to have all of the 'right stuff' for us to replace a dsPIC and a PIC24 on the next generation of our hardware.  New hardware will be here in a few weeks, so I better get started...
 
I have an Explorer 16/32 board and a PIC32MK1024MCF100 PIM.  I haven't been able to find any documentation on Microchip's website that this is a good match, but I am not doing motor control, just normal PIC32 stuff, including EQI, which is why we chose this part.  Any reason why this PIM won't work on the Explorer 16/32 board?
 
My first app just turns on an LED.  It doesn't work when I download it with the onboard PICKit.
 
When I try to debug it, I get the proverbial:
 
Programming/Verify complete
The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding. The most common causes for this failure are oscillator and/or PGC/PGD settings."
 
I have followed the Harmony config bits from the demo MK project.  The clock configuration is:
 
CONFIG_FPLLIDIV="DIV_1"
CONFIG_FPLLRNG="RANGE_5_10_MHZ"
CONFIG_FPLLICLK="PLL_POSC"
CONFIG_FPLLMULT="MUL_60"
CONFIG_FPLLODIV="DIV_4"
 
CONFIG_POSCMOD="EC"
 
to give me the 120 MHz block from the 8 MHz crystal on the Explorer board.
 
Any ideas?
#1

11 Replies Related Threads

    Aaron Hancock
    Junior Member
    • Total Posts : 87
    • Reward points : 0
    • Joined: 2016/02/23 15:10:25
    • Location: Virginia, USA
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/10 10:37:11 (permalink)
    0
    So, I got it to run by selecting the FRC.  That is good enough for my initial development.
    #2
    RodoPIC
    Senior Member
    • Total Posts : 145
    • Reward points : 0
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/10 14:21:56 (permalink)
    0
    Check the errata. Module: Primary Oscillator.
    #3
    Aaron Hancock
    Junior Member
    • Total Posts : 87
    • Reward points : 0
    • Joined: 2016/02/23 15:10:25
    • Location: Virginia, USA
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/10 14:37:43 (permalink)
    0
    Yeah, I see that now.  I am use to using external clocks rather than crystals.  The soon to arrive new hardware uses a clock so it won't have that problem.  In the meantime, I can limp along with the FRC or see if I can find a very small 2K resistor.
     
    Note: Never let a software guy near an SMD soldering station...
    #4
    RISC
    Super Member
    • Total Posts : 5365
    • Reward points : 0
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/10 15:47:15 (permalink)
    0
    Hi,
    There is a new development board for PIC32MK family which is supported by Harmony framework :
    http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=DM320106
    Regards
     
    #5
    Aaron Hancock
    Junior Member
    • Total Posts : 87
    • Reward points : 0
    • Joined: 2016/02/23 15:10:25
    • Location: Virginia, USA
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/11 05:41:20 (permalink)
    0
    Thanks for the information.  I had looked at this board earlier, but the GP version of the MK doesn't include the encoder interface (IQE) that we need.
    #6
    marcov
    Super Member
    • Total Posts : 238
    • Reward points : 0
    • Joined: 2006/10/08 01:59:40
    • Location: Eindhoven, NL.
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/11 07:50:32 (permalink)
    0
    I did the same, some things to consider:
     
    - there is a whole lot more to configure to get it running. (maybe better if you use Harmony, I didn't)
    - note that xxbits.field=1; notation is not atomic, kill it and use SET and CLR from the start
    - some interrupts are level rather than edge based. You really need to kill the condition to stop the interrupt from triggering.
     
    In the end I  decided to stay with dspic33e, mk was slower for me. Only when executing nops I could get some decent speed out of it. And to my knowledge I did configure it well (and read back the registers and doublechecked)
     
    #7
    Aaron Hancock
    Junior Member
    • Total Posts : 87
    • Reward points : 0
    • Joined: 2016/02/23 15:10:25
    • Location: Virginia, USA
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/05/11 11:39:08 (permalink)
    0
    So, it runs, blinking a few lights - using a bare metal timing loop.
    The next task is to get it to detect a USB memory stick (MSD).
    It turns out that while this MK has 2 USB interfaces, USB1's pins are not connected between the PIC and the SIM socket (PIC pins 54, 55, and 57).  USB2's pins are connected to the socket (PIC pins 58, 58 and 60 connected to SIM socket pins 53, 54 and 55).
    But all is not lost - yet.  The Explorer board has convenient rows of headers that may allow me to connect USB2 to the Type A connector on the Explorer board or to an external Type A.
     
    The big question now is, has anyone had success at using the Harmony USB stack with the 2nd USB interface on a PIC?
    The MHC GUI doesn't seem to have enough options to point the driver to the 2nd instance of hardware.
    Still digging through that.
    #8
    Blue_Key
    Junior Member
    • Total Posts : 113
    • Reward points : 0
    • Joined: 2011/12/20 04:48:22
    • Location: 0
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/06/13 03:37:37 (permalink)
    0
    I have the exact same setup and I'm also struggling to get it running.
     
    I'm still at the The target device is not ready for debugging. I've tried through the Harmony framework and also bare metal standalone.
     
    Either with external OSC or FRC + PLL no success so far.
     
    I guess there is an issue to my configuration bits (I'm new to the 32bit devices).
     
    Would you mind to share basic configuration and if there is further things to look at beside the configuration bits or if you had to make specific adjustment on the explorer 16/32 board (jumpers?).
     
     
     
    post edited by Blue_Key - 2018/06/13 19:53:44
    #9
    Blue_Key
    Junior Member
    • Total Posts : 113
    • Reward points : 0
    • Joined: 2011/12/20 04:48:22
    • Location: 0
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/06/13 03:38:39 (permalink)
    0
    duplicate
    #10
    Aaron Hancock
    Junior Member
    • Total Posts : 87
    • Reward points : 0
    • Joined: 2016/02/23 15:10:25
    • Location: Virginia, USA
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/06/13 05:28:20 (permalink)
    0
    The PIM has a 24 MHz clock on the underside of the circuit board.  Before I realized it was there, I had removed the 8 MHz crystal circuit and soldered in an 8 MHz clock chip.  When I discovered the 24 MHz clock, I removed 8 MHz clock and things went a lot better.  I was then able to run the PIC at 120 MHz and use the SPLL for the PBCLK.  My first task after I got the PIC running was to develop a USB based boot loader.  Since the PIM doesn't bring out the USB1 pins, I tried to use USB2, but ran into further issues with the pins the PIM connected to the PIM header.  That PIM is really designed for motor control and not general purpose work (which is what I am doing - no motors).
     
    I finally abandoned that effort and bought a PIC32MK1024GEP100 development board.  While my actual hardware will use the MCF version of the MK and not the GPE version, they are close enough that I can get most of the interfaces I need running.  The only thing the GPE lacks that I need is an encoder, which is the reason I chose the MCF in the first place.
     
    As for the issue with the chip not being ready for debugging, you need to enable DEBUG on the config bits and make sure that you are connect to or have selected the correct PD channel.
    #11
    Blue_Key
    Junior Member
    • Total Posts : 113
    • Reward points : 0
    • Joined: 2011/12/20 04:48:22
    • Location: 0
    • Status: offline
    Re: PIC32MK PIM on an Explorer 16/32 Board 2018/06/13 19:53:03 (permalink)
    0
    I finally got it working, I also went across this 24Mhz clock. 
     
    The main issue is that I was using PGx1 but the PIM reroute it to the PGx2.
     
    Here is the configuration I have in case it might help someone.
     
    // PIC32MK1024MCF100 Configuration Bit Settings
    // 'C' source line config statements
    // DEVCFG3
    // USERID = No Setting
    #pragma config PWMLOCK = OFF // PWM IOxCON lock (PWM IOxCON register writes accesses are not locked or protected)
    #pragma config FUSBIDIO2 = OFF // USB2 USBID Selection (USBID pin is controlled by the port function)
    #pragma config FVBUSIO2 = OFF // USB2 VBUSON Selection bit (VBUSON pin is controlled by the port function)
    #pragma config PGL1WAY = ON // Permission Group Lock One Way Configuration bit (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 FUSBIDIO1 = OFF // USB1 USBID Selection (USBID pin is controlled by the port function)
    #pragma config FVBUSIO1 = OFF // USB2 VBUSON Selection bit (VBUSON pin is controlled by the port function)
    // DEVCFG2
    #pragma config FPLLIDIV = DIV_1 // System PLL Input Divider (1x Divider)
    #pragma config FPLLRNG = RANGE_13_26_MHZ// System PLL Input Range (13-26 MHz Input)
    #pragma config FPLLICLK = PLL_POSC // System PLL Input Clock Selection (POSC is input to the System PLL)
    #pragma config FPLLMULT = MUL_20 // System PLL Multiplier (PLL Multiply by 20)
    #pragma config FPLLODIV = DIV_4 // System PLL Output Clock Divider (4x Divider)
    #pragma config VBATBOREN = ON // VBAT BOR Enable (Enable ZPBOR during VBAT Mode)
    #pragma config DSBOREN = ON // Deep Sleep BOR Enable (Enable ZPBOR during Deep Sleep Mode)
    #pragma config DSWDTPS = DSPS32 // Deep Sleep Watchdog Timer Postscaler (1:2^36)
    #pragma config DSWDTOSC = LPRC // Deep Sleep WDT Reference Clock Selection (Select LPRC as DSWDT Reference clock)
    #pragma config DSWDTEN = ON // Deep Sleep Watchdog Timer Enable (Enable DSWDT during Deep Sleep Mode)
    #pragma config FDSEN = ON // Deep Sleep Enable (Enable DSEN bit in DSCON)
    #pragma config BORSEL = HIGH // Brown-out trip voltage (BOR trip voltage 2.1v (Non-OPAMP deviced operation))
    #pragma config UPLLEN = OFF // USB PLL Enable (USB PLL Disabled)
    // DEVCFG1
    #pragma config FNOSC = SPLL // Oscillator Selection Bits (Primary Osc (HS,EC))
    #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 (Disable Secondary Oscillator)
    #pragma config IESO = ON // Internal/External Switch Over (Enabled)
    #pragma config POSCMOD = EC // Primary Oscillator Configuration (External clock mode)
    #pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin (Disabled)
    #pragma config FCKSM = 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 = 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 = OFF // Deadman Timer Enable (Deadman Timer is disabled)
    // DEVCFG0
    #pragma config DEBUG = ON // Background Debugger Enable (Debugger is enabled)
    #pragma config JTAGEN = OFF // JTAG Enable (JTAG Disabled)
    #pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select (Communicate on PGEC1/PGED1)
    #pragma config TRCEN = ON // Trace Enable (Trace features in the CPU are enabled)
    #pragma config BOOTISA = MIPS32 // Boot ISA Selection (Boot code and Exception code is MIPS32)
    #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 = MCLR_NORM // Soft Master Clear Enable (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_LEVEL_3 // Primary Oscillator Gain Control bits (Gain Level 3 (highest))
    #pragma config POSCBOOST = ON // Primary Oscillator Boost Kick Start Enable bit (Boost the kick start of the oscillator)
    #pragma config EJTAGBEN = NORMAL // EJTAG Boot Enable (Normal EJTAG functionality)
    #12
    Jump to:
    © 2018 APG vNext Commercial Version 4.5