Hello,
I tried to understand documentation for TWAI custom speeds but I still don't get it. I am trying to migrate the project from MCP2515 to native TWAI.
My problem is creating definition for custom speed 83K3 CAN speed. I cannot understand how to calculate values (brp , tseg1 , tseg2 and sjw) for the speed.
Can somebody help me?
Thank you
TWAI custom speed calculation
Re: TWAI custom speed calculation
I'm using the library ACAN_ESP32 v.1.1.2
there is automatic setting of parameters
LOG
there is automatic setting of parameters
Code: Select all
ACAN_ESP32_Settings settings (83333);
settings.mRequestedCANMode = ACAN_ESP32_Settings::NormalMode ;
const uint32_t errorCode = ACAN_ESP32::can.begin (settings) ;
if (errorCode == 0) {
Serial.println ("Configuration ESP32 83333 OK!");
Serial.print ("Bit Rate prescaler: ") ;
Serial.println (settings.mBitRatePrescaler) ;
Serial.print ("Phase segment 1: ") ;
Serial.println (settings.mTimeSegment1) ;
Serial.print ("Phase segment 2: ") ;
Serial.println (settings.mTimeSegment2) ;
Serial.print ("SJW:") ;
Serial.println (settings.mRJW) ;
Serial.print ("Actual bit rate: ") ;
Serial.print (settings.actualBitRate ()) ;
Serial.println (" bit/s") ;
Serial.print ("Exact bit rate ? ") ;
Serial.println (settings.exactBitRate () ? "yes" : "no") ;
Serial.print ("Sample point: ") ;
Serial.print (settings.samplePointFromBitStart ()) ;
Serial.println ("%") ;
}else{
Serial.print ("Configuration 83333 error 0x") ;
Serial.println (errorCode, HEX) ;
}
Code: Select all
11:20:50.403 -> Configuration ESP32 83333 OK!
11:20:50.403 -> Bit Rate prescaler: 20
11:20:50.403 -> Phase segment 1: 16
11:20:50.403 -> Phase segment 2: 7
11:20:50.403 -> SJW:4
11:20:50.403 -> Actual bit rate: 83333 bit/s
Who is online
Users browsing this forum: No registered users and 67 guests