/* Change Logs: Date Author Notes  sundm75 first version  */
unsigned char set_reset_mode(CAN_TypeDef *CANx)
/* Change Logs: Date Author Notes  sundm75 first version  */
unsigned char set_reset_mode(CAN_TypeDef *CANx)
{
  unsigned char status;
  int i;
  status = CANx->MOD;
  CANx->IER = 0x00;
  for (i = 0; i < 100; i++)
  {
    if((status & CAN_Mode_RM) == CAN_Mode_RM)
        return 1;
    CANx->MOD |=  ((unsigned char)CAN_Mode_RM);
    delay_us(10);
    status = CANx->MOD;
  }
  printf("\r\nSetting SJA1000 into reset mode failed!\r\n");
  return 0;  
}