Matlab-Simulink device driver Blockset for Microchip dsPIC / PIC24 / PIC32 Microcontrollers.

Release Notes

From http://www.kerhuel.eu/wiki - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
Revision as of 22:55, 10 September 2012 by LubinKerhuel (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Download the PIC / dsPIC Blockset for Simulink v3.7e (10 sep 2012) suporting 100 chips.

Older blockset version fot theses older matlab release :

Supported microcontroller : 100



See Release Notes and known bug for details

PIC 24F ' PIC 32F** ' PIC 30F ' PIC 30F ' PIC 33FJ GP ' PIC 33FJ MC ' PIC 33FJ GP ' PIC 33FJ MC*
24fJ128GA006 32MX360F256L 30f2010 30f5011 33fJ128GP206 33fJ256MC510 33fj128GP202 33fj128MC202
24fJ128GA008 32MX360F512L 30f2011 30f5013 33fJ128GP306 33fJ256MC710 33fj128GP204 33fj128MC204
24fJ128GA010 32MX460F256L 30f2012 30f5015 33fJ128GP310 33fJ64MC506 33fj128GP802 33fj128MC802
24fJ64GA006 32MX460F512L 30f3010 30f5016 33fJ128GP706 33fJ64MC508 33fj128GP804 33fj128MC804
24fJ64GA008 32MX775F256L 30f3011 30f6010 33fJ128GP708 33fJ64MC510 33fj32GP302 33fj32MC302
24fJ64GA010 32MX775F256L 30f3012 30f6011 33fJ128GP710 33fJ64MC706 33fj32GP304 33fj32MC304
24fJ96GA006 32MX795F512L 30f3013 30f6012 33fJ256GP506 33fJ64MC710 33fj64GP202 33fj64MC202
24fJ96GA008 32MX320 30f3014 30f6013 33fJ256GP510 33fJ128MC506 33fj64GP204 33fj64MC204
24fJ96GA010 32MX340 30f4011 30f6014 33fJ256GP710 33fJ128MC510 33fj64GP802 33fj64MC802
24fJ16GA002 30f4012 30f6015 33fJ64GP206 33fJ128MC706 33fj64GP804 33fj64MC804
24fJ32GA002 30f4013 33fJ64GP306 33fJ128MC708
24fJ48GA002 33fJ64GP310 33fJ128MC710
24fJ64GA002 33fJ64GP706
24fJ16GA004 33fJ64GP708
24fJ32GA002 33fJ64GP710
24fJ48GA002
24fJ64GA002
Newly added chip 
64MC204, 128MC204, 128GP202, 32MC202, 32MC204, 16MC304 , 33FJ256GP710A
* PIC 32F
SPI function not suported yet;
* Compiler known and fixed bugs 
* Check your compiler installation and version 
at the matlab prompt ==> !pic30-gcc -v for pic30 and !pic32-gcc -v for pic32.
**Check pic32 compiler v 1.04 Workaround
**Check pic30 compiler PWM 2 Workaround from version v 3.12 to current version (3.25)...


  • a bug were repported for PIC32 : problem appears when configuring with a fast clock (80Mhz) The problem is fixed by adding a c line code : SYSTEMConfigPerformance(80000000). This bug has not been checked yet.
  • 10/09/2012: v3.7e
    • PWM motor : added Fault protection option
    • Added PIC32MX320 & PIC32MX340
    • update blockset for compatibility with the new XC16 & XC32 compiler.
  • 09/01/2012: v3.7c
    • Bugfix: pic30f ==> new compiler C30 v3.31 is released. ICD Fuses were revert back to FICD. Blockset is updated and will work properly with suported 30f chip. (when used with latest C30 v3.31 version)

  • 09/01/2012: v3.7c
    • Bugfix: pic30f ==> new compiler C30 v3.31 is released. ICD Fuses were revert back to FICD. Blockset is updated and will work properly with suported 30f chip. (when used with latest C30 v3.31 version)

  • 19/12/2011: v3.7b
    • Minor bug correction : ADC block sometimes did not store parameters of output format (required to set parameters each time model were opened).
    • Bugfix: MPLAB project creation : try to correct some bugs detailed in http://www.kerhuel.eu/forum/viewtopic.php?f=8&t=457 (Not tested yet on model provided by Bryant)
    • Remark FICD fuse has been renamed as ICD with some version of C30 compiler. Next compiler release (v3.31) will fixe the problem ==> Need update generated code consequently if using compiler version 3.30

  • 08/10/2011: v3.7
    • Bugfix: Simulink model Error report were corrupted by the blockset. (forum)
    • Bugfix: Permanent problem reported with older matlab (R2007b, perhaps affecting also R2008 and R2009... (forum))

  • 11/09/2011: v3.6c
    • Correcting link to open MPLAB X

  • 07/09/2011: v3.6b
    • C Function Call: Adding port configuration to block. Allows to configure I/O port used by your own function.
    • Bugfix : MPLAB X was supported only on Win32. Now supported on both Win32 and Win64
    • Adding few check on dupicated blocks (some blocks should appears only once in a model)

  • 25/07/2011: v3.6
    • Suport MPLAB X : Generated C code files can be opened as a project within the new MPLAB X IDE (tested with Beta 0.6)
    • Chip added : 256GP710A

  • 15/05/2011: v3.5b
    • Corrected definition of chip 128GP802
    • Chip added : 64MC204, 128MC204, 128GP202, 32MC202, 32MC204, 16MC304

  • 21/04/2011: v3.5
    • Suport for multi-tasking added (Many thanks to Vojtěch Lamberský from VUT Brno for sharing results and fruitfull discussions about multi-tasking)
    • C function call, add start, and init function. Start function is called only once (for initialisation). Init function is called once at startup and each time the block is reseted. Init function may be simplified (disapear) if block is chained with constant value for example.
    • MPLAB project created has relative path. Few bugs corrected
    • UART: possibility to disable interrupt (in case you want to write your own interrupt driver, for GPS parsing or other background task...)
    • Few correction on CAN block (Tq parameters should have -1 with this new version to behave like the previous blockset version.)

  • 01/03/2011: v3.4c
    • C function Call now available with the demo version
    • 7 I/O pin available with the demo version
    • Add the block "info block" that lists used ports
    • Improved warning message for peripheral port's conflict
    • rs232gui : adding custom speed rate and custom port com (work with MACs)
    • Add auto-psv on interrupts definition (avoir warning)
    • Examples updates
    • add 24fjxxGA002 and 24fjxxGA004
    • Bug corrected when two UART were used
    • Adding PWM2 variable for using PWM2 motor peripheral

  • 13/01/2011: v3.4b
    • Power save mode (IDLE), Correctede bug:timer 2,3,4,5... did not reacts properly in idle mode, making any peripheral using theses timer not working properly WHEN the POWER SAVE MODE were activated (in Master block).
    • Adding compatibility with Clock Switch: When this option in the Master block is activated, the clock is configured through a robust switching code that can change the previous clock configuration. This is usefull when using a bootloader.
    • Adding a Clock Switch to LP block. This block allow to modify main clock online so as to be able to lower the power consumption. Note however that real time constraints and peripheral will be affected by this change. This mode may be usefull while the electronic device is being charged for example. Pooling a pin that indicate charging mode make the software able to switch back to normal operations.

  • 30/12/2010: v3.4
    • Input Capture : ICxMax value corresponded to the max time defined including the margin (10% by default). Now Corrected (ICxMAX = max time without the margin)
    • Change Notification : CNxMax value corresponded to the max time defined including the margin (10% by default). Now Corrected (CNxMAX = max time without the margin)
    • External Interrupt : INTxMax value corresponded to the max time defined including the margin (10% by default). Now Corrected (INTxMAX = max time without the margin)
    • Corrected bug on SPI for slave mode: the peripheral stoped working when the SPI internal buffer overflowed (in slave mode only)
    • 33f, 24h and 24f: Now can use switching clock capacity of the dsPIC (might be usefull for example when dsPIC is used with a booloader)
    • Improve UART config block available information (block mask)
    • 33f chips : improved algorithm to find best choice for pre and post diviser for PLL configuration
    • 33f chips corrected bug: internal FAST RC oscillator did not worked properly with PLL.
    • added examples demonstrating data transmission between two dsPIC through PWM signal, SPI bus and CAN bus.

  • 24/12/2010: V3.3c
    • Corrected bug: Matlab crash when an error was detected in the model (port dimension invalide, data type error etc...)
    • UART Rx/Tx blocks: added Ordering Input/Output ports
    • UART config block: add the possibility to set non standard (custom) baud rate

  • 05/12/2010: v3.3b
    • C30 compiler V3.25 did not work with the blockset. Problem should now be solved
    • MPLAB project : Try to create projects with relative path if it is possible

  • 21/11/2010: v3.3a
    • Slight change for compatibility with Matlab 2007a
    • Examples: Some model example were configured to suport complex and infinite signals values. This configuration can create bugs at compilation time. This optional suport has been unchecked for all examples. (examples do not use such signals anyway)

  • 8/11/2010: V3.3
    • New : Create MPLAB project file that make easy the integration of the generated code into MPLAB. It allow to re-compile it, to use MPLAB tool (like debuger) and add your c code.
    • Added Chip (experimental): 32MX975F512L 32MX775F512L 32MX775F256L
    • PIC32: New options available relative to External Clock
    • Corrected bug: code does not compile on some chip endowed with memory protection (FSS)
    • Corrected bug:
    • Corrected warning: ICS option cause a "bit configuration" warning appears when loading the .hex file into MPLAB
    • Added alternatie I2C pin for I2C peripheral
    • Change extension of the binary resulting of the compilation from .coff to .cof.
    • Corrected bug. As described in revision of 11/02/2008, the Microchp def file Generic.h had to be corrected to be able to compile the code for some 24h type PIC. This correction should not be done anypore as the blockset re-generate a corrected version of the Generic.h file.

  • 23/07/2010: V3.2c
    • Corrected bug : it was impossible to open a model if the compiler used for that model were missing
    • Corrected a bug on the installer that make the blockset not working on some systems
    • Corrected bug : on some systems, GMAKE was not find automatically
    • Stop support MATLAB 2006a and MATLAB 2006b. Updating theses versions may be possible on demand ; please send email : RTWdsPIC@kerhuel.eu.

  • 31/03/2010: V3.2b
    • Corrected missing files in V3.2 just released make it unworkable on some systems !
    • Added support for Matlab 2010a (both 32 & 64 bits)

  • 28/03/2010: V3.2
    • Better integration within windows 7 0x64 bits
    • Better integration with compiler C30 or C32
    • added JTAG and PGD (1, 2 or 3) options in Master block

  • 17/11/2009: V3.1
    • added Dead Time option, for PWM motor peripheral. see forum

  • 26/09/2009: V3.0b
    • demo Version V3.0 had a limitation that (will) make it not workable from October 17th 2009. This limitation is removed.

  • 26/09/2009: V3.0
    • Bug : in some matlab version (at least 2009a), an error appears : Corrupted package making the whole blockset unworkable. It is now corrected
    • change version numbering

  • 04/09/2009: V0.99h
    • Bug : PWM for chip with 1 PWM had bug (since blockset revision 0.99g)
    • Installation script do not update matlab path correctly. That make the blockset unworkable

  • 08/07/2009: V0.99g
    • Support PWM motor for chip with 2 PWM motor peripheral (32f and some 33f)
    • Correct Output Compare 2 on dsPIC 30f3012 (defined on pin D1 instead of B7)

  • 04/06/2009: V0.99f
    • Better error report : messages easier to understand
    • Bug corrected : Input Capture 7 and 8 on dsPIC with remappable pins (typically 33f) did not work. Repaired now.

  • 04/06/2009: V0.99e
    • Rx block now can maintain the last value received (when default is set to -1)
    • rs232gui : improved robustess
    • Bug corrected : ADC on some dsPIC : now force AD1PCFGH to 0 when no digital output are used (instead of leaving its default value that should be 0 however)
    • Bug corrected that make CAN2 unusable
    • bug corrected : SPI2 now can works with the interrupt block

  • 19/04/2009: V0.99d
    • Bug corrected on the installer script
    • added option POR of 128ms for dsPIC33f
    • Bug corrected while compiling newly created model
    • Bug corrected on the ADC: Blocks output are always in the increasing order. If you set in the ADC channels [5 3 2], the first output blocks is channel 2, the second is channel 3 and the last is channel 5, despite the wrong output port label. Output port label is now shows in the correct increasing order. (no change on block's output, leave your model as is to have no functional change. Label only have changed).
    • 2 chips added : 32MX360F256L and 32MX460F256L.
    • added support of matlab 2009a

  • 12/03/2009 V0.99c
    • Speed up the compilation process
    • Automatic timer setting is improved. Watch out : Peripheral max timer value may have change (typically, minus 1)
    • Correction : max AN value is set to 1023 instead of 1024 for 10 bits conversion and 2047 instead of 2048 for 12 bit ADC conversion
    • Support Output Compare mode in Hardware (allows fast event like short duty cycle and short PWM periode that caused problems in the input Compare implementation that used interrupts.)
    • Possibility to trig the ADC with the Output Compare peripheral. Allows to start a conversion at any place within the PWM periode of the OC peripheral.

  • 01/02/2009: V0.99b
    • Peripheral added on PIC32 chip : Output Compare (OC), Input Capture (IC), External Interrupt (EI)
    • added 4 chip...

  • 28/10/2008: V0.99a
    • 20 Chips added for experimental use: 33fj64GP802, 33fj128GP802, 33fj32GP302, 33fj64GP202, 33fj128GP202, 33fj64GP804, 33fj128GP804, 33fj32GP304, 33fj64GP204, 33fj128GP204, 33fj64MC802, 33fj128MC802, 33fj32MC302, 33fj64MC202, 33fj128MC202, 33fj64MC804, 33fj128MC804, 33fj32MC304, 33fj64MC204, 33fj128MC204. Add of the Mapping_PIN block for the remappable peripheral function available on theses chips. PWM Motor block NOT WORKING YET on theses MC chip !
    • Corrected bug in UART Rx function when interrupt driven with the option 'When a character is received'. With this configuration, any buffer overflow hang the UART reception definitly.
    • Correct bug in PWM Motor block that may give rise to error while opening Master block or while compiling
    • Correct bug in I2C that give rise to a compilation error in specific conditions
    • improvment of the Matlab Graphical User Interface rs23gui that receive and decode datas from the UART. Add possibility to do very long log by writting directly received data in a file.
    • add options in Master block for advanced clock configuration

  • 16/09/2008 : V0.98fe
    • Error When the Master block is placed in a subsystem (solved)
    • Easier installation and integration with C30 and C32 tool. Model started from scratch get problem with previous version (error like gld file not found ...)

  • 02/09/2008 : V0.98fc
    • Error in the ADC definition of the 33FJxxxGP710 family. ADC input above 21 were not defined correctly. Thus they may not work properly.
    • Bug (affecting all PIC/dsPIC) few perpheral or digital input/output sharing a pin with an unused ADC input may not be configured properly in very specific configuration (Solved)

  • 09/08/2008 : V0.98f
    • Should work even if the C30 compiler is not in the windows path.

  • 15/07/2008 : V0.98e
    • Corrected Bug : Typo bug on PLLODIF factor for configuration of PIC32f.

  • 18/06/2008 : V0.98d
    • Corrected Bug : Peripheral using commun PIN with ADC Channel between [16 - 31] or ADC Channel between [16 - 31] may not be configured properly.
    • Improved rs232gui interface (Matlab Graphical User Interface for reception of UART datas from the microcontroller)

  • 12/06/2008 V0.98c
    • Corrected Bug : UART 1 and UART 2, if both used on a model did not worked with interrupt.
    • Corrected Bug : SPI 1 and SPI 2, if both used on a model, did not worked with interrupt
    • Corrected Bug : External Interrupt peripheral did not worked when more than one external Interrupt channel were used.
    • The block Interface Tx Matlab should now appears on every matlab version in the dsPIC Library

  • 09/06/2008 V0.98b
    • Corrected Bug : ADC of Chip 33f did not worked when using more than one channel
    • Corrected Bug : UART when used with interrupt may corrupt data when used with buffer size larger than 256 bytes.

  • 21/05/2008 V0.98a1
    • Solved Problem when upgrading the blockset : Script to update model created with oldest blockset version is not working properly.

  • 20/05/2008 V0.98
    • New : Early Support for Pic32 (UART, ADC, digital In/out are supported ; others peripheral are comming next)
    • Added : PIC32MX360F512L, PIC32MX460F512L
    • Works with the last version of the Microchip dsPIC and PIC24 C compiler (v3.10) and with the PIC32 compiler (v1.02) Updating your compiler is necessary ! (download from the microchip website)
    • add an SPI master block interrupt driven
    • Bug correction on "C function Call" block
    • Others minor improvements

  • 01/04/2008 V0.97
    • PIC 24f : Not need anymore to modify Generic.h file.
    • UART Rx Tx peripheral : you can choose to use this peripheral using interrupt and lets you define the internal buffer for Tx and Rx. It Allows to send or receive bursts of data containing more than 4 bytes (internal peripheral buffer)
    • add the block Chronograph. This block allows to measure precisely the execution time of a very specific part of the model (a filter for example). Execution time of several parts can be measured simultanously.

  • 13/02/2008 V0.96b
    • C30 compiler can now be installed in the directory : 'C:\Programmi\Microchip\MPLAB C30' (for italian I guess)

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 11/02/2008 V0.96
    • SPI block : Add Sample Time option ; Add possiblity to reconfigure SPI bus speed (allow to get 2 component working at different speed on the bus)
    • UART Tx block : Corrected bug : possibility to send vector
    • I2C : New peripheral to test
    • CAN : New peripheral to test. Note that ECAN is not done yet. If you are interrested for the ECAN peripheral, ask for on the forum.
    • Corrected bug : The Time Step time refference based on timer1 was too high (get a typical time error of 1/10000). The calcul is exact now.

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 9/12/2007 V0.95b
    • Corrected bug : C function Call did not work properly when more than one input was defined.
    • C function Call can now call assembly language functions. The assembly language files (.s) will be compiled.
    • Blocks with sample time can takes 2 parameters for the sample time like others Simulink blockset : [SampleTime Offset] (see simulink help about sample time). When using only one parameters, the offset is 0. The offset could not be defined in previous blockset version.
    • Add one block to Configure the model for dsPIC.

When the model is used with another Matlab version, you should reconfigure the simulink model using this bloc. (see examples in the sample directory of the toolbox)

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 06/10/2007 V0.95a
    • Is now compatible with matlab with different coding characters( Taiwan, Chinese, Japanese...)
    • Block "Calculus Time Step": When overload occurs, ie Time Step > to Sample time of the schematic, get a false value. Now, when overload occurs, return the value PR1.
    • Corrected bug : Only Timer 2 or 3 can be assigned to the peripheral Output Compare (OC) and Input Compare (IC). Timer assignation is automatic and now include this constraint.
    • Compatible with MATLAB R2007b
    • Added : 33FJ64GP206, 33FJ128GP206, 33FJ64GP306, 33FJ128GP306, 33FJ64GP310, 33FJ128GP310, 33FJ256GP506, 33FJ256GP510, 33FJ64GP708, 33FJ128GP708, 33FJ64MC506, 33FJ128MC506, 33FJ256MC510, 33FJ64MC508, 33FJ128MC510, 33FJ256MC710*, 33FJ64MC510, 33FJ128MC706, 33FJ64MC706, 33FJ128MC708, 33FJ64MC710, 33FJ128MC710

Thanks to Evidence Srl for providing a Flex Board for Microchip dsPIC based on 33FJ256MC710 allowing to test the toolbox with this chip.

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 18/08/2007 V0.94e
    • Know BUG : Output Compare PWM generation does not work when Power Save mode is activated on 30f4013 and probably on others chips!

Output Compare is working otherwise

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 05/08/2007 V0.94d
    • Corrected bug : The PLL calculation to achieve the desired MIPS did not work and generate an error on dsPIC 33f chips.

Know BUG : Output Compare PWM generation does not work when Power Save mode is activated on 30f4013 and probably on others chips! Output Compare is working otherwise

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 02/08/2007 V0.94c
    • Find and corrected one bug in the "Output Compare" Block

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 21/07/2007 V0.94b
    • few bug fixe
    • Added : 30F3014, 30F5011, 30F5013, 30F5015, 30F5016, 30F6010A, 24FJ96GA006, 24FJ128GA006, 24FJ64GA006, 24FJ64GA008, 24FJ96GA008, 24FJ128GA008
    • Compatible with C compiler v3.01
    • Temperature Protection is no more available on the compiler def files.

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 15/07/2007 V0.94
    • User interface is now more user friendly
    • Compatible with C compiler v3.01
    • Temperature Protection is no more available on the compiler def files.

Know bug : before compiling schematic for dsPIC 24f, you must remove the line 56 of Generic.h file which is in "C:\Program Files\Microchip\MPLAB C30\support\h\peripheral_24F" The line : "typedef enum _BOOL { FALSE = 0, TRUE } BOOL;" does not compile !


  • 03/06/2007 V0.93b
    • Corrected bugs :
      • UART 1 was unusable in V0.93. Only UART 2 worked
      • some dsPIC had their IC7 and IC8 peripheral defined as IC3 and IC4. That did not compile (undefined refference to IC3 and IC4 registers)

  • 27/05/2007 V0.93
    • Added dsPIC 24FJ: 24fJ64GA010, 24fJ96GA010, 24fJ128GA010
    • Added dsPIC 33FJ: 33fJ64GP706, 33fJ128GP706
    • Real time plotting and logging Data block support extended to 32bits uint and int data type

  • 13/05/2007 V0.92
    • Max number of I/O port limitation set to 6
    • Added 'Free run' mode (master block)
    • Added dsPIC 33f : 33fJ64GP710, 33fJ128GP710, 33fJ256GP710
    • Bugfix : Master block sometimes lose its data when opening the model
    • Bugfix : block Uart Rx stopped receiving if overrun occure

  • 23/04/2007 V0.91
    • Bugfix : Master block lose its data when opening the block dialog.
    • added dsPIC 30f6011,30f6012,30f6013 and 30f6014

  • 17/04/2007 V0.90
    • (bugfix, added dsPIC 30f3010 and 30f3011)

Early 2007 : first version released (no date or version number)



admin Template:blocksetVersion Template:blocksetDate Template:blocksetNbrChips Template:picList