Can mapping question

Post Reply
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Can mapping question

Post 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!
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Can mapping question

Post 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
User avatar
johu
Site Admin
Posts: 5681
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 959 times
Contact:

Re: Can mapping question

Post 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.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Can mapping question

Post by Ev8 »

Thanks, I just had to look up what that meant but yes that makes sense,
User avatar
EV_Builder
Posts: 1199
Joined: Tue Apr 28, 2020 3:50 pm
Location: The Netherlands
Has thanked: 16 times
Been thanked: 33 times
Contact:

Re: Can mapping question

Post 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..
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: Can mapping question

Post 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
Post Reply