Page 1 of 1

Can mapping question

Posted: Wed Jun 22, 2022 6:31 am
by Ev8
Hi guys this will be an easy question for someone but
can messages are still a minefield in my brain not helped by the fact they are sometimes in hex, decimal etc, it makes my brain hurt and want to go back to welding something.

Anyway I’m trying to send out from the vcu the motor rpm to the RX8 can bus this info is needed importantly to start the PAS and run the Rev counter,

All information I’ve found indicates that the message needs to be sent to address 0x201 (513) and is determined by
Rpm x 3.85 with the resulting value is split across 2 8bit values highbyte to byte 0 and low byte to byte 1.

Now I presume as it wants to 2 separate 8bit values to work that this isn’t possible via the can mapping as I can only map one message per spot value and I can’t sent it a 16 but value starting at byte 0 because that’s a different format to the 2 8bit values it wants, this is where my head starts to hurt,

Im thinking I need to add another device on my can bus, send a can message for rpm to that from the vcu and have it spit it back out in the correct format for the car, this is the route I’ll be perusing unless anyone can see through the stupid and tell me stop your doing it wrong!

Re: Can mapping question

Posted: Wed Jun 22, 2022 7:04 am
by Ev8
The more I read about can bus and 16bit messages being 2 8 bit messages with values of up to 255 each which are arrived at by bit shifting? The more confused I become! Seems like it should be possible

Re: Can mapping question

Posted: Wed Jun 22, 2022 7:06 am
by johu
hibyte, lobyte - Sounds like "big endian" to me. So not the native little endian of the stm32. That's why you cannot map it as one 16-bit value.
Not sure if it works, you can try sending speed*256*3,85 on hibyte and speedx3.85 on lobyte

I think the current CAN module doesn't allow gain>32 so may not work. I will release an updated CAN module soon.

Re: Can mapping question

Posted: Wed Jun 22, 2022 8:14 am
by Ev8
Thanks, I just had to look up what that meant but yes that makes sense,

Re: Can mapping question

Posted: Mon Jun 27, 2022 10:15 pm
by EV_Builder
Ev8 wrote: Wed Jun 22, 2022 7:04 am The more I read about can bus and 16bit messages being 2 8 bit messages with values of up to 255 each which are arrived at by bit shifting? The more confused I become! Seems like it should be possible
its not that it are seperate messages its just that in a std message there is room for 8 bytes.
So to transmit a 16bit value you need to interpret the order the same. Which of the 8bits represents the *256 number...
and on top of that CanBus even makes use of every bit so in reallife a 16bit digit could start at bit nr 3...etc..

Re: Can mapping question

Posted: Sat Jul 02, 2022 3:30 pm
by Ev8
Thanks guys I’ve got my head mostly round this and dash and power steering is working now, I’m using an arduino nano to receive speed data from the open inverter board on one can Id then sending out a message on the correct id for the dash with the bytes swapped around, seems to do the job, I’m going to also use the arduino to perform some other useful functions like switching the auxiliary oil pump on and off etc