Difference between revisions of "Microchip dsPIC33 PIC24"

From ERIKA WIKI
Jump to: navigation, search
(Created page with "== Introduction == ERIKA3 supports Microchip dsPIC33/PIC24 CPU of Microchip dsPIC33EV256GM106 MCU.<br> Such support has been successfully tested on the following board: * [ht...")
 
Line 6: Line 6:
  
 
Documentation coming soon...
 
Documentation coming soon...
 +
 +
= Synopsys =
 +
This manual describes the porting details of the ERIKA Enterprise v3 kernel(s) for Microchip dsPIC33/PIC24 families of microcontrollers.
 +
 +
* dsPIC33/PIC24 integration features
 +
** Support for [http://ww1.microchip.com/downloads/en/DeviceDoc/MPLABX-v4.05-windows-installer.exe MPLAB-X IDE v4.05]
 +
** Support for [http://ww1.microchip.com/downloads/en/DeviceDoc/xc16-v1.33-full-install-windows-installer.exe MPLAB XC16 C Compiler v1.33]
 +
** Support for the following families Microchip dsPIC33/PIC24 MCUs:
 +
*** [http://www.microchip.com/design-centers/16-bit/products/dspic33f-dspic33e dsPIC33EV]
 +
**** [http://www.microchip.com/wwwproducts/en/dsPIC33EV256GM106 dsPIC33EV256GM106] specific MCU
 +
** Support for following boards
 +
*** [http://www.microchip.com/developmenttools/productdetails.aspx?partno=dm330018 dsPIC33EV 5V CAN-LIN STARTER KIT] (dsPIC33EV256GM106)
 +
 +
= Configuration and Programming =
 +
 +
ERIKA Enterprise is configured through [[Tutorial: RT-Druid and OIL basics | 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 [[Common oil.pref example|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 [[Common oil.pref example|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.
 +
 +
* <code>OSCFAIL</code>: External Pin, Power-on Reset, Brown-out Reset and Watchdog System Reset
 +
* <code>ADDRERR</code>: External Interrupt Request 0
 +
* <code>SGHT</code>: External Interrupt Request 1
 +
* <code>STKERR</code>: Pin Change Interrupt Request 0
 +
* <code>MATHERR</code>: Pin Change Interrupt Request 1
 +
* <code>DMACERR</code>: Pin Change Interrupt Request 2
 +
* <code>SGST</code>: Watchdog Time-out Interrupt
 +
* <code>INT0</code>: Timer/Counter2 Compare Match A
 +
* <code>IC1</code>: Timer/Counter2 Compare Match B
 +
* <code>OC1</code>: Timer/Counter2 Overflow
 +
* <code>T1</code>: Timer/Counter1 Capture Event
 +
* <code>DMA0</code>: Timer/Counter1 Compare Match A
 +
* <code>IC2</code>: Timer/Coutner1 Compare Match B
 +
* <code>OC2</code>: Timer/Counter1 Overflow
 +
* <code>T2</code>: Timer/Counter0 Compare Match A
 +
* <code>T3</code>: Timer/Counter0 Compare Match B
 +
* <code>SPI1E</code>: Timer/Counter0 Overflow
 +
* <code>SPI1</code>: SPI Serial Transfer Complete
 +
* <code>U1RX</code>: USART Rx Complete
 +
* <code>U1TX</code>: USART, Data Register Empty
 +
* <code>AD1</code>: USART, Tx Complete
 +
* <code>DMA1</code>: Conversion Complete
 +
* <code>NVM</code>: EEPROM Ready
 +
* <code>SI2C1</code>: Analog Comparator
 +
* <code>MI2C1</code>: 2-wire Serial Interface
 +
* <code>CMP1</code>: Store Program Memory Ready
 +
* <code>CN</code>: External Pin, Power-on Reset, Brown-out Reset and Watchdog System Reset
 +
* <code>INT1</code>: External Interrupt Request 0
 +
* <code>DMA2</code>: External Interrupt Request 1
 +
* <code>OC3</code>: Pin Change Interrupt Request 0
 +
* <code>OC4</code>: Pin Change Interrupt Request 1
 +
* <code>T4</code>: Pin Change Interrupt Request 2
 +
* <code>T5</code>: Watchdog Time-out Interrupt
 +
* <code>INT2</code>: Timer/Counter2 Compare Match A
 +
* <code>U2RX</code>: Timer/Counter2 Compare Match B
 +
* <code>U2TX</code>: Timer/Counter2 Overflow
 +
* <code>SPI2E</code>: Timer/Counter1 Capture Event
 +
* <code>SPI2</code>: Timer/Counter1 Compare Match A
 +
* <code>C1RX</code>: Timer/Coutner1 Compare Match B
 +
* <code>C1</code>: Timer/Counter1 Overflow
 +
* <code>DMA3</code>: Timer/Counter0 Compare Match A
 +
* <code>IC3</code>: Timer/Counter0 Compare Match B
 +
* <code>IC4</code>: Timer/Counter0 Overflow
 +
* <code>PSEM</code>: SPI Serial Transfer Complete
 +
* <code>U1E</code>: USART Rx Complete
 +
* <code>U2E</code>: USART, Data Register Empty
 +
* <code>C1TX</code>: USART, Tx Complete
 +
* <code>CTMU</code>: Conversion Complete
 +
* <code>PWM1</code>: EEPROM Ready
 +
* <code>PWM2</code>: Analog Comparator
 +
* <code>PWM3</code>: 2-wire Serial Interface
 +
* <code>ICD</code>: Store Program Memory Ready
 +
* <code>I2C1</code>: USART Rx Complete
 +
* <code>SENT1ERR</code>: USART, Data Register Empty
 +
* <code>SENT1</code>: USART, Tx Complete
 +
* <code>SENT2ERR</code>: Conversion Complete
 +
* <code>SENT2</code>: EEPROM Ready
 +
* <code>ECCSBE</code>: 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''' or'''T2'''or ... or '''T5''' as shown below.
 +
 +
 +
  COUNTER SystemTimer {
 +
    MINCYCLE = 1;
 +
    MAXALLOWEDVALUE = 65535;
 +
    TICKSPERBASE = 1;
 +
    TYPE = HARDWARE {
 +
      DEVICE = "T1";
 +
      SYSTEM_TIMER = TRUE;
 +
    };
 +
    SECONDSPERTICK = 0.001;
 +
  };
 +
  
 
[[Category:Architectures]]
 
[[Category:Architectures]]

Revision as of 16:31, 24 May 2018

Introduction

ERIKA3 supports Microchip dsPIC33/PIC24 CPU of Microchip dsPIC33EV256GM106 MCU.
Such support has been successfully tested on the following board:

Documentation coming soon...

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;
 };