I have a question regarding the can configuration on the dsPIC
The CAN Lib CAN1Initialize(-----) set the CAN Main Clock (Fcan) to 4*Tcy or Fosc according to the Datasheet the bit
C1CTRL.CANCKS = 0 'Set CANCKS FCAN = 4* FCY = Fosc
I want to have C1CTRL.CANCKS = 1 'Set CANCKS FCAN = FCY
is this ok when I manually set the bit durion initialization as shown in
code below
Thanks for your help
Code: Select all
CAN_Config_Flags = CAN_CONFIG_SAMPLE_THRICE and
CAN_CONFIG_PHSEG2_PRG_ON and
CAN_CONFIG_STD_MSG and
CAN_CONFIG_DBL_BUFFER_ON and
CAN_CONFIG_MATCH_MSG_TYPE and
CAN_CONFIG_LINE_FILTER_OFF
CAN1Initialize(1,0,9,8,1,CAN_Config_Flags) 'initialize CAN
C1CTRL.CANCKS = 1'Set CANCKS FCAN = FCY
CAN1SetOperationMode(CAN_MODE_CONFIG,0xFF)'set CONFIG mode
CAN1SetMask(CAN_MASK_B1, -1, CAN_CONFIG_MATCH_MSG_TYPE
and CAN_CONFIG_XTD_MSG)
CAN1SetMask(CAN_MASK_B2, -1, CAN_CONFIG_MATCH_MSG_TYPE
and CAN_CONFIG_XTD_MSG)
CAN1SetFilter(CAN_FILTER_B1_F1,$3E0,CAN_CONFIG_XTD_MSG)
CAN1SetFilter(CAN_FILTER_B1_F2,$3E2,CAN_CONFIG_XTD_MSG)
CAN1SetFilter(CAN_FILTER_B2_F1,$25B,CAN_CONFIG_XTD_MSG)
CAN1SetFilter(CAN_FILTER_B2_F2,$25C,CAN_CONFIG_XTD_MSG)
CAN1SetFilter(CAN_FILTER_B2_F3,$258,CAN_CONFIG_XTD_MSG)
CAN1SetFilter(CAN_FILTER_B2_F4,$259,CAN_CONFIG_XTD_MSG)
CAN1SetOperationMode(CAN_MODE_NORMAL,0xFF) 'set NORMAL mode