RPM CanBus Scaling 0x1DA

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

eBIMMER

Member
Joined
Jun 6, 2020
Messages
7
So CanBus message on bytes 4 and 5 of 0x1DA reads RPM. Does anybody know the proper scaling for this value to get actual RPM of motor?

I use the Leaf system in another vehicle without the gearbox so it is a little harder to figure it out mathematically.

Multiplying x10 is too high, as the value read 14,200 at one point.

Anybody? Thanks!
 
Yes, it is a signed message with no scaling. Just pay attention to where it starts, and the signed bit indicating positive/negative rotation

m0ajhA5.png

https://github.com/dalathegreat/leaf_can_bus_messages
 
Thank you for the reply. I am very new to working with Canbus and interpreting bytes, etc.

Based on your input it sounds like the problem must be in my code and possibly the way I'm handling the values. I adjusted a bit shift, removed scaling, and will see what sorts of values I get.

I am using an Arduino to process the signals and then sending via serial to a display, so there are a few places where I could be skewing the number.

Thanks again!
 
I have been struggling a little bit to get my values to read properly. I hope somebody here who understand byte processing can help tell me what I'm doing wrong.

The Arduino code that interprets my RPM value is below:

Code:
RPM = (rxBuf[4] << 2) | (rxBuf[5] >> 6);

But this outputs RPM values that hover around 35 and range from 0 up to about 60.

I am going to try the line below, which is my best guess at "gluing the byte values together" based on some tutorials I've read online:

Code:
RPM = (rxBuf[4] << 8) | rxBuf[5];

I would be grateful for any advice on this from those who know.

Thanks! :mrgreen:
 
The most significant bit is the sign bit. The rest contains the data. Quick pseudocode to read RPM and disregard the sign would be

int rpm = ((frame4 & 0x7F ) << 7) | frame5 >> 1;

This might be wrong, it's 1AM and I'm tired :D
 
Dala said:
Yes, it is a signed message with no scaling. Just pay attention to where it starts, and the signed bit indicating positive/negative rotation

I've downloaded the DB tool - thank you for linking me to this. It will be incredibly helpful!

I'm editing this post based on your last reply. Thank you for the help. My removed post suggested scaling by 0.641 so max value would be 10,500 which I believe is the max speed of the motor.

I'll hold off on scaling and try your code to bypass the sign bit. I should note that we may be using different Leaf systems. I'm using a ZEO and per the database for this vehicle, these bytes are listed as being an unsigned value. Anyway, per your reply, the line going onto my Arduino for test is below. I should have an update in a few hours or a day.

Code:
RPM = (rxBuf[4] << 7) | (rxBuf[5] >> 1 );

Thanks again!
 
Back
Top