Microchip dsPIC33 PIC24

From ERIKA WIKI
Revision as of 18:30, 24 May 2018 by Pj (talk | contribs) (Introduction)
Jump to: navigation, search

Introduction

ERIKA3 now supports Microchip dsPIC33/PIC24 MCUs.

The following MCUs are currently supported:

  • dsPIC33EV256GM106

Such support has been successfully tested on the following board:


Tutorials

The following tutorials are available for this board:

Synopsys

This manual describes the porting details of the ERIKA Enterprise v3 kernel(s) for Microchip dsPIC33/PIC24 families of microcontrollers.

Configuration and Programming

ERIKA Enterprise is configured through RT-Druid and an OIL file. Here are listed, after the information to set compiler path, the OIL fields customized for Microchip dsPIC33/PIC24 architecture.

MPLAB-X IDE Path

It is possible to choose the path in three different ways:

  • Specific environment variables: MPLAB_X_IDE_FILES
    • E.g.: MPLAB_X_IDE_FILES=C:\Program Files (x86)\Microchip\MPLABX\v4.05
  • RT-Druid Eclipse IDE Property.
  • RT-Druid Configuration File Entry: preference_dspic33_pic24__path_for_mplab_x_ide
    • E.g.: preference_dspic33_pic24__path_for_mplab_x_ide=C:\Program Files (x86)\Microchip\MPLABX\v4.05

Here is an example of RT-Druid configuration file.

MPLAB XC16 C Compiler Path

It is possible to choose the path in three different ways:

  • Specific environment variables: XC16_TOOLS
    • E.g.: XC16_TOOLS=C:\Program Files (x86)\Microchip\xc16\v1.33
  • RT-Druid Eclipse IDE Property.
  • RT-Druid Configuration File Entry: preference_dspic33_pic24__path_for_xc16_compiler
    • E.g.: preference_dspic33_pic24__path_for_xc16_compiler=C:\Program Files (x86)\Microchip\xc16\v1.33

Here is an example of RT-Druid configuration file.

CPU

CPU_DATA object must be set to DSPIC33_PIC24.

MODEL attribute of MCU_DATA supports for now the dsPIC33 value only.

Example of a CPU_DATA section:

   CPU_DATA = DSPIC33_PIC24 {
     MODEL = dsPIC33;
     ...
   };

MCU

MCU_DATA object supports for now the dsPIC33EV value only.

MODEL attribute of MCU_DATA supports for now the dsPIC33EV256GM106 value only.

Example of a MCU_DATA section:

 MCU_DATA = dsPIC33EV {
   MODEL = dsPIC33EV256GM106;
 };

BOARD

BOARD_DATA object supports for now the dsPIC33EV_SK value only.

Example of a BOARD_DATA section:

 BOARD_DATA = dsPIC33EV_SK;

Interrupt Handling

Interrupt Handling is microcontroller dependent so for each supported Microchip dsPIC33/PIC24 microcontroller family, the ISRs configuration of ERIKA Enterprise v3 is shown below.

dsPIC33EV Family

The dsPIC33EV family of dsPIC33/PIC24 microcontrollers has an interrupt vector table which is stored in the flash memory. The lowest addresses of the interrupt vector table are allocated to the RESET and to the interrupt vectors. Interrupt handlers placed at lower addresses have higher hardware priorities than interrupt handlers placed at higher addresses so the PRIORITY attribute of the ISR object in the OIL is USELESS. The complete list of SOURCE entries is shown below.

  • OSCFAIL: External Pin, Power-on Reset, Brown-out Reset and Watchdog System Reset
  • ADDRERR: External Interrupt Request 0
  • SGHT: External Interrupt Request 1
  • STKERR: Pin Change Interrupt Request 0
  • MATHERR: Pin Change Interrupt Request 1
  • DMACERR: Pin Change Interrupt Request 2
  • SGST: Watchdog Time-out Interrupt
  • INT0: Timer/Counter2 Compare Match A
  • IC1: Timer/Counter2 Compare Match B
  • OC1: Timer/Counter2 Overflow
  • T1: Timer/Counter1 Capture Event
  • DMA0: Timer/Counter1 Compare Match A
  • IC2: Timer/Coutner1 Compare Match B
  • OC2: Timer/Counter1 Overflow
  • T2: Timer/Counter0 Compare Match A
  • T3: Timer/Counter0 Compare Match B
  • SPI1E: Timer/Counter0 Overflow
  • SPI1: SPI Serial Transfer Complete
  • U1RX: USART Rx Complete
  • U1TX: USART, Data Register Empty
  • AD1: USART, Tx Complete
  • DMA1: Conversion Complete
  • NVM: EEPROM Ready
  • SI2C1: Analog Comparator
  • MI2C1: 2-wire Serial Interface
  • CMP1: Store Program Memory Ready
  • CN: External Pin, Power-on Reset, Brown-out Reset and Watchdog System Reset
  • INT1: External Interrupt Request 0
  • DMA2: External Interrupt Request 1
  • OC3: Pin Change Interrupt Request 0
  • OC4: Pin Change Interrupt Request 1
  • T4: Pin Change Interrupt Request 2
  • T5: Watchdog Time-out Interrupt
  • INT2: Timer/Counter2 Compare Match A
  • U2RX: Timer/Counter2 Compare Match B
  • U2TX: Timer/Counter2 Overflow
  • SPI2E: Timer/Counter1 Capture Event
  • SPI2: Timer/Counter1 Compare Match A
  • C1RX: Timer/Coutner1 Compare Match B
  • C1: Timer/Counter1 Overflow
  • DMA3: Timer/Counter0 Compare Match A
  • IC3: Timer/Counter0 Compare Match B
  • IC4: Timer/Counter0 Overflow
  • PSEM: SPI Serial Transfer Complete
  • U1E: USART Rx Complete
  • U2E: USART, Data Register Empty
  • C1TX: USART, Tx Complete
  • CTMU: Conversion Complete
  • PWM1: EEPROM Ready
  • PWM2: Analog Comparator
  • PWM3: 2-wire Serial Interface
  • ICD: Store Program Memory Ready
  • I2C1: USART Rx Complete
  • SENT1ERR: USART, Data Register Empty
  • SENT1: USART, Tx Complete
  • SENT2ERR: Conversion Complete
  • SENT2: EEPROM Ready
  • ECCSBE: Analog Comparator

OSEK/VDX Extensions

This Section contains information about the OSEK/VDX Extensions (or optional features) that have been implemented for the dsPIC33/PIC24 support.

System Timer

System Timer is microcontroller dependent so for each supported Microchip dsPIC33/PIC24 microcontroller family, the System Timer configuration of ERIKA Enterprise v3 is shown below.

dsPIC33EV Family

For the dsPIC33EV family of dsPIC33/PIC24 microcontrollers the System Timer is linked to Hardware Timers so the DEVICE attribute MUST be se to T1 orT2or ... or T5 as shown below.


 COUNTER SystemTimer {
   MINCYCLE = 1;
   MAXALLOWEDVALUE = 65535;
   TICKSPERBASE = 1;
   TYPE = HARDWARE {
     DEVICE = "T1";
     SYSTEM_TIMER = TRUE;
   };
   SECONDSPERTICK = 0.001;
 };