Independent CAN BUS transmitt on V2 board  [SOLVED]

Post Reply
arber333
Posts: 3276
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 239 times
Contact:

Independent CAN BUS transmitt on V2 board

Post by arber333 »

Hi

I would like to know if i can use inverter board to send my custom CAN messages when inverter is in operation.
What i desire is to send msg to DCDC converter which is Ampera part.
CAN ID is 01 D4, Msg is A0 B2 in 50ms period. Can i programm your Rev 2 board to do that when it is in operation Johannes?

tnx
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: Independent CAN BUS transmitt on V2 board

Post by nailgg »

This could easily be done with some minor software modification, by placing the lines below at the end of the Ms10Task in stm32_sine.cpp. But this would send your message in every 10ms of course.

Code: Select all

static void Ms10Task(void)
{
   ...
   
   if (MOD_RUN == opmode) {
      uint32_t myCanData[2] = { 0xA0B20000, 0x00000000 };
      uint32_t myCanId = 0x000001D4;

      Can::Send(myCanId, myCanData);
   }
arber333
Posts: 3276
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 239 times
Contact:

Re: Independent CAN BUS transmitt on V2 board

Post by arber333 »

nailgg wrote: Wed Jul 03, 2019 6:18 pm This could easily be done with some minor software modification, by placing the lines below at the end of the Ms10Task in stm32_sine.cpp. But this would send your message in every 10ms of course.

Code: Select all

static void Ms10Task(void)
{
   ...
   
   if (MOD_RUN == opmode) {
      uint32_t myCanData[2] = { 0xA0B20000, 0x00000000 };
      uint32_t myCanId = 0x000001D4;

      Can::Send(myCanId, myCanData);
   }
No, what i meant was if i could setup any custom ID and MSG inside web interface to be output in the blind. It could just as easily be some inverter parameter, but i would like it to be that specific code. I could say it would be a CAN heartbeat for inverter.
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: Independent CAN BUS transmitt on V2 board

Post by nailgg »

With the current software you can only send the existing parameters like udc, speed etc. The software needs to be modified in order to be able to define arbitrary messages through the web interface (or console) other than the existing parameters. Maybe Johannes or someone else could implement sending arbitrary data over CAN other than already existing parameters. But I think the easiest solution for your case is hardcoding your custom data into the software, at least for current version.
arber333
Posts: 3276
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 239 times
Contact:

Re: Independent CAN BUS transmitt on V2 board

Post by arber333 »

nailgg wrote: Wed Jul 03, 2019 7:53 pm With the current software you can only send the existing parameters like udc, speed etc. The software needs to be modified in order to be able to define arbitrary messages through the web interface (or console) other than the existing parameters. Maybe Johannes or someone else could implement sending arbitrary data over CAN other than already existing parameters. But I think the easiest solution for your case is hardcoding your custom data into the software, at least for current version.
What about if i would declare parameter that is always on when inverter is working, like "din_forward"? Then i would assign ID MSG and interval whatever i like. Would that work?
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: Independent CAN BUS transmitt on V2 board

Post by nailgg »

Hmm. That sounds like a nice little hack. So your message is 0xA0 0xB2 which is 41138 in decimal. Maybe you can send din_forward or even better opmode with 41138 gain. Might be worth trying.

Code: Select all

can tx opmode 468 0 16 41138
User avatar
johu
Site Admin
Posts: 5836
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 163 times
Been thanked: 1058 times
Contact:

Re: Independent CAN BUS transmitt on V2 board

Post by johu »

Sorry gain is signed 16 bit but you could still do it byte-wise.
Of course to map one signal in multiple places you can't use the web interface but the command you suggest will work multiple times

Code: Select all

can tx opmode  468 0 8 160
can tx opmode  468 8 8 178
(I'm sure I swapped bytes ;) )
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 3276
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 239 times
Contact:

Re: Independent CAN BUS transmitt on V2 board

Post by arber333 »

So if i can understand how it works...

I need to broadcast ID 01D4 with byte0 A0 and byte1 B2.
This would then look like this?

can tx opmode 468 0 8 160
can tx opmode 468 1 8 178

why the 8? If this is two byte message shouldnt i use 2 instead?

tnx
nailgg
Posts: 119
Joined: Sat Dec 22, 2018 8:40 pm

Re: Independent CAN BUS transmitt on V2 board  [SOLVED]

Post by nailgg »

arber333 wrote: Mon Jul 08, 2019 6:58 pm can tx opmode 468 0 8 160
can tx opmode 468 1 8 178

why the 8? If this is two byte message shouldnt i use 2 instead?

Code: Select all

can tx opmode       468    0          8          160
can tx opmode       468    8          8          178
can tx PARAMETER    CANID  START_BIT  LENGTH     GAIN
With the first line, you define a signal of 8-bit length that starts from the bit 0. So your data will be on bits 0:7. You are streaming opmode with 160 gain. That would give you 0xA0 on the first byte when opmode==1 and 0x00 when opmode==0

With the second line, you define a signal of 8-bit length that starts from the bit 8. So your data will be on bits 8:15. You are streaming opmode with 178 gain. That would give you 0xB2 on the second byte when opmode==1 and 0x00 when opmode==0
arber333
Posts: 3276
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 80 times
Been thanked: 239 times
Contact:

Re: Independent CAN BUS transmitt on V2 board

Post by arber333 »

OK i see. I will try this.

tnx
User avatar
dima
Posts: 157
Joined: Sun Dec 09, 2018 9:35 pm
Location: Canada

Re: Independent CAN BUS transmitt on V2 board

Post by dima »

I cannot find what is exact command for removing individual can tx? Not clear command - that clears everything.

Tried all combinations:

Code: Select all

can tx opmode remove
can opmode remove
can remove opmode
User avatar
johu
Site Admin
Posts: 5836
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 163 times
Been thanked: 1058 times
Contact:

Re: Independent CAN BUS transmitt on V2 board

Post by johu »

Code: Select all

can del opmode
In fact just the 'd' is important, so 'd' 'del', 'delete' all work
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply