CANBUS timing question

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 32-bit PIC MCUs
Post Reply
Author
Message
tsadowski_wn
Posts: 24
Joined: 18 Feb 2019 15:50

CANBUS timing question

#1 Post by tsadowski_wn » 03 Dec 2019 17:10

Hi,

I am using a PIC32MZ at 200Mhz. The CANBUS is happily ticking at 250kbits (4us bit time) with:

CAN2Initialize(1,25,3,3,1,Can_Init_Flags);

However if I try to calculate the timing I don't get the expected result.

PB5DIV = 0x8801 -> PBCLK5 = 100MHz

F_TQ = PBCLK5 / (2*(BRP+1)) = 1.923MHz

F_BAUD = F_TQ / (SyncSeg + PropSeg + PhaseSeg1 + PhaseSeg2)
= 1.923 MHz / (1 + 2 + 4 + 4) = 175kbits

Where am I wrong?

Best Regards,
Torsten

tsadowski_wn
Posts: 24
Joined: 18 Feb 2019 15:50

Re: CANBUS timing question

#2 Post by tsadowski_wn » 04 Dec 2019 11:03

It seems I misunderstood the CANxInitialize parameters. The parameters are the prescaler and time quanta values and not the corresponding register values, which are off by 1.

Cheers,
Torsten

Post Reply

Return to “PIC32 PRO Compilers”