Skip to content

Commit

Permalink
Added MikroE PIC32MX Clicker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
majenkotech committed Nov 3, 2015
1 parent c5dde5a commit a53229b
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bootloaders/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#define vend4DSystems 0x0008
#define vendMajenko 0x0009
#define vendOpenBCI 0x000A
#define vendMikroE 0x000B
#define vendExperimental 0x8000

#define prodUnassigned 0xFFFF
Expand Down Expand Up @@ -132,6 +133,7 @@
#include "configs/examples.h"
#include "configs/fubarino.h"
#include "configs/majenko.h"
#include "configs/mikroe.h"
#include "configs/olimex.h"
#include "configs/openbci.h"
#include "configs/pontech.h"
Expand Down
10 changes: 10 additions & 0 deletions bootloaders/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ DEF_ebbv3-usb=-D_BOARD_EBBV3_USB_
LKR_ebbv3-usb=MX1-2-USB-boot-linkerscript.ld
CFL_ebbv3-usb=-mips16

# MikroE configurations

BIN_mikroe-clicker=MIKROE_PIC32MX_CLICKER
OBJ_mikroe-clicker=main.o usb.o cdcacm.o
CRT_mikroe-clicker=crt0.S
MCU_mikroe-clicker=32MX534F064H
DEF_mikroe-clicker=-D_BOARD_MIKROE_PIC32MX_CLICKER_
LKR_mikroe-clicker=MX3-7-boot-linkerscript.ld
CFL_mikroe-clicker=-mips16

CFLAGS=-mprocessor=${MCU_${BOARD}} ${DEF_${BOARD}} ${CFL_${BOARD}} -Os -mno-float -I.
ASFLAGS=-Wa,--gdwarf-2 -mprocessor=${MCU_${BOARD}} ${DEF_${BOARD}} ${CFL_${BOARD}} -Os -mno-float -I.
LDFLAGS=-mprocessor=${MCU_${BOARD}} -nostdlib -nostartfiles ${CFL_${BOARD}} -mno-float -T ${LKR_${BOARD}} -Wl,--gc-sections -ffunction-sections -fdata-sections
Expand Down
75 changes: 75 additions & 0 deletions bootloaders/configs/mikroe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* MikroE boards */

#define prodPIC32MXClicker 0x0001

#if defined(_BOARD_MIKROE_PIC32MX_CLICKER_)
#define _CONFIG_VALID_

#if defined(PUT_CONFIG_BITS_HERE)

// DEVCFG3
// USERID = No Setting
#pragma config FSRSSEL = PRIORITY_7 // SRS Select (SRS Priority 7)
#pragma config FCANIO = ON // CAN I/O Pin Select (Default CAN I/O)
#pragma config FUSBIDIO = ON // USB USID Selection (Controlled by the USB Module)
#pragma config FVBUSONIO = ON // USB VBUS ON Selection (Controlled by USB Module)

// DEVCFG2
#pragma config FPLLIDIV = DIV_2 // PLL Input Divider (2x Divider)
#pragma config FPLLMUL = MUL_20 // PLL Multiplier (20x Multiplier)
#pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider (2x Divider)
#pragma config UPLLEN = ON // USB PLL Enable (Enabled)
#pragma config FPLLODIV = DIV_1 // System PLL Output Clock Divider (PLL Divide by 1)

// DEVCFG1
#pragma config FNOSC = PRIPLL // Oscillator Selection Bits (Primary Osc w/PLL (XT+,HS+,EC+PLL))
#pragma config FSOSCEN = ON // Secondary Oscillator Enable (Enabled)
#pragma config IESO = OFF // Internal/External Switch Over (Disabled)
#pragma config POSCMOD = HS // Primary Oscillator Configuration (HS osc mode)
#pragma config OSCIOFNC = OFF // CLKO Output Signal Active on the OSCO Pin (Disabled)
#pragma config FPBDIV = DIV_1 // Peripheral Clock Divisor (Pb_Clk is Sys_Clk/1)
#pragma config FCKSM = CSECME // Clock Switching and Monitor Selection (Clock Switch Enable, FSCM Enabled)
#pragma config WDTPS = PS1024 // Watchdog Timer Postscaler (1:1024)
#pragma config FWDTEN = OFF // Watchdog Timer Enable (WDT Disabled (SWDTEN Bit Controls))

// DEVCFG0
#pragma config DEBUG = OFF // Background Debugger Enable (Debugger is disabled)
#pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select (ICE EMUC2/EMUD2 pins shared with PGC2/PGD2)
#pragma config PWP = OFF // Program Flash Write Protect (Disable)
#pragma config BWP = OFF // Boot Flash Write Protect bit (Protection Disabled)
#pragma config CP = OFF // Code Protect (Protection Disabled)

#endif

#define CAPABILITIES (blCapBootLED | blCapDownloadLED | blCapUSBInterface | blCapProgramButton | blCapVirtualProgramButton | CAPCOMMON)

// BTN / LED sense
#define LedOn High
#define BntOn Low

// Boot LED
#define BLedLat D
#define BLedBit 1

// Data LED
#define DLedLat D
#define DLedBit 4

// Virtual program button
#define VPBntLat B
#define VPBntBit 4

// Program button
#define PBntPort B
#define PBntBit 4

#define _CPU_NAME_ "32MX534F064H"
#define VEND vendMikroE
#define PROD prodPIC32MXClicker
#define F_CPU 80000000UL
#define F_PBUS F_CPU

#define FLASH_BYTES 0x10000 // 64K
#define FLASH_PAGE_SIZE 4096
#define LoadFlashWaitStates() (CHECON = 2) // 0 for 0-30Mhz, 1 for 31-60Mhz, 2 for 61-80Mhz
#endif

0 comments on commit a53229b

Please sign in to comment.