Hi Jennie,
thank you for reply, but.....
If I want to use KEA128 series MCU for my application, how do I change the bit rate? Even without using PE....
I tried to implement the following snippet code:
/* the init speed is 250Kbits/s, if the bit rate is different change the speed after timeout */
while((!DataFrameRxFlg) && (Timeout<TIMEOUT_MS))
{
/* Wait until data frame is received or trigger timeout*/
}
if(Timeout>TIMEOUT_MS) // After timeout change can bus bit rate (5 s)
{
//Timeout reset
Timeout = 0;
// Disable can bus driver
CAN1_Disable(MyCANPtr);
/* MSCAN_CANBTR0: SJW=0,BRP=0x21 */
MSCAN_CANBTR0 = (MSCAN_CANBTR0_SJW(0x00) | MSCAN_CANBTR0_BRP(0x21)); /* Set the timing register 0 */
/* MSCAN_CANBTR1: SAMP=0,TSEG2=1,TSEG1=3 */
MSCAN_CANBTR1 = (MSCAN_CANBTR1_TSEG2(0x01) | MSCAN_CANBTR1_TSEG1(0x03)); /* Set the timing register 1 */
//Enable can bus driver
CAN1_Enable(MyCANPtr);
}
/* now the bit rate is about 100Kbits/sec */
but after timeout (5 seconds) it seems occurs a system reset and the speed doesn't change.
I remember that can bus received data frame with interrupt service.
Thank you
Paolo A.