Blockset described on this wiki is deprecated since 2012.
For Model Based Design (MBD), use the free MPLAB Device Blocks for Simulink, tool from Microchip.
Updated Rapid Control Prototyping (RCP) custom projects are published at: https://lubin.kerhuel.eu.
Difference between revisions of "DsPIC Block/CAN Configuration"
LubinKerhuel (talk | contribs) (New page: Configuration for the CAN Peripheral When using either a CAN receive block or a CAN Transmit block, this block configure the mode and the CAN BUS parameters. =Dialog Box Parameters= ==N...) |
LubinKerhuel (talk | contribs) m (LubinKerhuel moved page Block/CAN Configuration to DsPIC Block/CAN Configuration: Block is a special page, creates many issues) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[Image:Block_CAN_Configuration.png|thumb|rght|Block CAN Configuration]] | ||
Configuration for the CAN Peripheral | Configuration for the CAN Peripheral | ||
− | When using either a CAN | + | When using either a CAN Receive block or a CAN Transmit block, this block configure the mode and the CAN BUS parameters. |
=Dialog Box Parameters= | =Dialog Box Parameters= | ||
− | + | [[Image:Block_CanConfig_DialogBox.png|thumb|right|450px|CAN Configuration Dialog]] | |
==Num CAN== | ==Num CAN== | ||
− | Ref to the CAN peripheral being configured (some | + | Ref to the CAN peripheral being configured (some PICs have two CAN buses) |
==Mode== | ==Mode== | ||
Configure the mode of the CAN peripheral. Four options are available. | Configure the mode of the CAN peripheral. Four options are available. | ||
− | *Normal : the one you will use in most | + | *Normal : the one you will use in most cases. |
− | *Loop back : | + | *Loop back : Allows testing of the CAN peripheral and the CAN blockset. In this mode, no external connection or driver is necessary to make the CAN peripheral work. Messages transmitted are routed directly into the receive logic. |
− | *Listen only : | + | *Listen only : The CAN peripheral receives messages on the bus without transmitting (not even acknowledge bits). |
+ | This mode will use only the Receive pin of the CAN peripheral The Transmit pin can be used for another purpose. | ||
*Disable : shut down the CAN peripheral. | *Disable : shut down the CAN peripheral. | ||
+ | ==These parameters configure the Timing of the CAN bus. Refer to the CAN documentation for more information.== | ||
+ | The existing parameter prompts are poor: I have suggested new ones here | ||
+ | (the block-set still looks as shown). | ||
− | |||
*TRefCAN | *TRefCAN | ||
− | * | + | *Baud Rate Prescaler - 1 |
− | * | + | *Propagation Time Segment quanta |
*Phase Buffer Segment 1 | *Phase Buffer Segment 1 | ||
− | *Sample | + | *Times to Sample |
*Phase Buffer Segment 2 | *Phase Buffer Segment 2 | ||
*Synchronisation max jump (Tq) | *Synchronisation max jump (Tq) | ||
− | The time quanta Tq and the | + | |
+ | The time quanta Tq and the bus frequency Fcan are updated in the Info display each time one of these parameters is modified. | ||
==Sample Time== | ==Sample Time== | ||
Line 33: | Line 38: | ||
==Info== | ==Info== | ||
− | Information, | + | Information: the time quantum length Tq and the baud rate of the CAN, given the input oscillator timing TRefCan |
+ | |||
+ | ==Warning== | ||
+ | The baud rate is currently incorrectly given for at least the pic30f6014A. | ||
+ | It corresponds to 1 more quantum than is actually given to each bit. | ||
+ | Reduce one of the segment lengths by 1 quantum temporarily to see the | ||
+ | correct baud rate. | ||
+ | |||
+ | In addition, the smallest bit length should be 8 quanta, but the block allows fewer | ||
+ | than this to be configured (and shown in the Info display). | ||
+ | |||
+ | I suspect this affects many, if not all, PIC microcontrollers with CAN (rather than ECAN) modules. | ||
+ | |||
+ | see forum related remark: http://www.kerhuel.eu/forum/viewtopic.php?f=8&t=387 |
Latest revision as of 19:30, 3 May 2015
Configuration for the CAN Peripheral
When using either a CAN Receive block or a CAN Transmit block, this block configure the mode and the CAN BUS parameters.
Contents
Dialog Box Parameters
Num CAN
Ref to the CAN peripheral being configured (some PICs have two CAN buses)
Mode
Configure the mode of the CAN peripheral. Four options are available.
- Normal : the one you will use in most cases.
- Loop back : Allows testing of the CAN peripheral and the CAN blockset. In this mode, no external connection or driver is necessary to make the CAN peripheral work. Messages transmitted are routed directly into the receive logic.
- Listen only : The CAN peripheral receives messages on the bus without transmitting (not even acknowledge bits).
This mode will use only the Receive pin of the CAN peripheral The Transmit pin can be used for another purpose.
- Disable : shut down the CAN peripheral.
These parameters configure the Timing of the CAN bus. Refer to the CAN documentation for more information.
The existing parameter prompts are poor: I have suggested new ones here (the block-set still looks as shown).
- TRefCAN
- Baud Rate Prescaler - 1
- Propagation Time Segment quanta
- Phase Buffer Segment 1
- Times to Sample
- Phase Buffer Segment 2
- Synchronisation max jump (Tq)
The time quanta Tq and the bus frequency Fcan are updated in the Info display each time one of these parameters is modified.
Sample Time
Sample time of the block. -1 for inherited
Block Ordering Input / Output
If you want to force the execution order of blocks that are not connected, this option allow to add either an input, an output or both to the block. These virtual connection allow to force the ordering of the blocks.
Info
Information: the time quantum length Tq and the baud rate of the CAN, given the input oscillator timing TRefCan
Warning
The baud rate is currently incorrectly given for at least the pic30f6014A. It corresponds to 1 more quantum than is actually given to each bit. Reduce one of the segment lengths by 1 quantum temporarily to see the correct baud rate.
In addition, the smallest bit length should be 8 quanta, but the block allows fewer than this to be configured (and shown in the Info display).
I suspect this affects many, if not all, PIC microcontrollers with CAN (rather than ECAN) modules.
see forum related remark: http://www.kerhuel.eu/forum/viewtopic.php?f=8&t=387