Help with CAN

Discussion about various user interfaces such as web interface, displays and apps
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Help with CAN

Post by Jack-Lee »

Hello,

I can not cope with the little information of the wiki.
How can I send CAN signals? The table in the web interface, unfortunately, I do not quite understand. Is there a description of what is meant by "Plot" "l" "r" "Map to CAN" and so on? How do I get the engine temperature for example on ID 0x123 on CAN output?

I thank you for the help.

Greeting,
Patrick
PoloLbricolo
Posts: 78
Joined: Wed Apr 10, 2019 2:32 pm
Location: France
Been thanked: 1 time

Re: Help with CAN

Post by PoloLbricolo »

Hi,

The L (left) and R (right) litle boxes are for live plotting, to use it, you clik the box (for example rpm and L) and scroll down to plotting and click start plot, it will show the rpm live with the scale on the left.

To send can messages you have to specify the ID (in decimal) for example 0X123 would be ID 291 then what position is you data and how long and finaly the gain ie multiplier. Then click on can TX and save parameters. That should do it.

Keep in mind that the inverter will spit out can data as soon as it is powered on.
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Re: Help with CAN

Post by Jack-Lee »

Hi,
i have my problems with "Position" and "Bits". What exactly i should write in the boxes?
Bits = 8 , Position = ?
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Help with CAN

Post by johu »

A CAN message can have up to 8 data bytes i.e. 64 data bits
0 1 ... 62 63
The positions field specifies were in those 64 bits your data is put. So if your specify 16 as position and 8 as length:
x x x x x x x x x x x x x x x x y o u r d a t a x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Re: Help with CAN

Post by Jack-Lee »

Hi,
But a "2" in Theorie length and Position field means what? Two Byte, Two bit?
thats the thing that was unclear.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Help with CAN

Post by johu »

two bits
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Re: Help with CAN

Post by Jack-Lee »

And the "Position"? They couldnt mean bit 2, when Thema Information is one Byte long.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Help with CAN

Post by johu »

Yes it's bits. Why don't you just experiment and see what happens. Nothing can break.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Re: Help with CAN

Post by Jack-Lee »

Hi,
I tried. But i couldnt get any Signal from the can sniffer. With the can in my smart roadster, i could read out the Massages.

Im new with can Systems and the Controllerboard /Webinterface.
PoloLbricolo
Posts: 78
Joined: Wed Apr 10, 2019 2:32 pm
Location: France
Been thanked: 1 time

Re: Help with CAN

Post by PoloLbricolo »

Have you setup the can ? ie speed to be the same on both devices ? Is your bus terminated ?
You should have 60 ohm between CAN H and CAN L.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Help with CAN

Post by johu »

Right, "canspeed" defaults to 250kbit/s. Does that correlate with your sniffer?
Point is: even if you don't get the bit banging right you should still see *a* message
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Re: Help with CAN

Post by Jack-Lee »

Hi,
yea can speed at 250k, Bus terminatet with 120ohm.
I would try another can sniffer next week, the actual one is not the Best (25€ cam Bus analyzer)
User avatar
dima
Posts: 157
Joined: Sun Dec 09, 2018 9:35 pm
Location: Canada

Re: Help with CAN

Post by dima »

The "other" new web-interface in works for CAN :D I think the trick to receive proper can messages is to set Gian to 32. Also only one direction TX or RX not both.

Here is an early preview. Support for CANable, uCCB and USB2CAN, what adapters are you using?

scheenshot1.png
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Help with CAN

Post by Jack Bauer »

Looks great:)
I'm going to need a hacksaw
User avatar
langoo
Posts: 65
Joined: Thu May 09, 2019 6:27 pm
Location: Varberg, Sweden

Re: Help with CAN

Post by langoo »

dima wrote: Wed Jul 24, 2019 3:50 am The "other" new web-interface in works for CAN :D I think the trick to receive proper can messages is to set Gian to 32. Also only one direction TX or RX not both.

Here is an early preview. Support for CANable, uCCB and USB2CAN, what adapters are you using?


scheenshot1.png
Add the USBtin to the list:

https://www.fischl.de/usbtin/
Robin Hellström
MR Electronics AB
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Help with CAN

Post by johu »

Nice work! So does the web interface somehow communicate over CAN? Because you're mentioning the adapter
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
dima
Posts: 157
Joined: Sun Dec 09, 2018 9:35 pm
Location: Canada

Re: Help with CAN

Post by dima »

johu wrote: Thu Jul 25, 2019 1:02 pm Nice work! So does the web interface somehow communicate over CAN? Because you're mentioning the adapter
No, just a lot of background work like preps the drivers (Windows) and installs "Cantact App" or "Cangaroo App" and firmware updates (takes care of DFU installation and such) good for DIY adapters like USB2CAN, which I soldered myself and confirm working :)
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Help with CAN

Post by doobedoobedo »

My turn to be confused about the CAN interface. I've been looking at the wiki and I should be able to get and set parameters using SDO.

I have a cantact board and have been sending stuff back and forth with an arduino. The brain board does respond but not how I would expect it to from what's in the wiki.

cansend to get the first parameter:

Code: Select all

cansend can0 601#2220000000000000
gives the following
candump:

Code: Select all

can0  601   [8]  22 20 00 00 00 00 00 00   '" ......'
can0  581   [8]  80 20 00 00 00 00 02 06   '. ......'
The response is 'invalid index' shifted 2 bytes right?

edit: I'm using the latest FOC code from github
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Help with CAN

Post by doobedoobedo »

OK been experimenting some more, sending 0x20 as the third byte gets a 581 response

so to get syncofs (index 8 from using list)

Code: Select all

cansend can0 601#2200200800000000
gets me

Code: Select all

can0  601   [8]  22 00 20 08 00 00 00 00   '". .....'
can0  581   [8]  43 00 20 08 80 00 00 00   'C. .....'
syncofs is currently set to 2500. The returned value doesn't change if I change syncofs.

list:

Code: Select all

Available parameters and values
curqkp [] (index 0)
curqki [] (1)
curdkp [] (2)
curdki [] (3)
fweak [Hz] (4)
idweak [A/Hz] (5)
fmax [Hz] (6)
dirchrpm [rpm] (7)
syncofs [dig] (8)
...
User avatar
dima
Posts: 157
Joined: Sun Dec 09, 2018 9:35 pm
Location: Canada

Re: Help with CAN

Post by dima »

Just an observation :shock:

It sounds like you are going "complicated" route. It looks like you are using "candleLight" firmware with your canable. It is good for advanced captures but not for newbies. Second firmware is called "slcan" it uses COM to "proxy" your CAN messages - this way you use a nice GUI interface.

Here is some firmware builds for your CAN adapter: https://canable.io/builds/
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Help with CAN

Post by doobedoobedo »

Yes I am using candlelight. I'm quite comfortable with command line and getting it going was very simple. I only broke it out because my arduino (with CAN shield) code didn't seem to be doing what was expected. The arduino sends and receives exactly the same as cansend and candump, so I'm not sure how a UI will change that?

Do you have CAN working with that UI? I'd be very interested in whether the messages were the same.

Admittedly I've not re-flashed the CAN adaptor yet but that UI fails with:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.netbeans.ProxyURLStreamHandlerFactory (file:~/CAN/cantact/platform/lib/boot.jar) to field java.net.URL.handler
WARNING: Please consider reporting this to the maintainers of org.netbeans.ProxyURLStreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Help with CAN

Post by doobedoobedo »

re-flashed the adaptor and same error.
Jack-Lee
Posts: 21
Joined: Mon Jun 24, 2019 8:32 pm
Location: Germany

Re: Help with CAN

Post by Jack-Lee »

Hi,
i buy a "CanUSB" Dongle and now i see CAN-Signals :)
I try to send the "Version" Value "4.17.R" to the CAN. I find the CAN-Package (001), but in there is only this
CAN.png
I Write in the WebInterface at "Version" row :
-CanID : 001
-Position : 1
-Bits : 16
-Gain : 1
-Map to Can TX

Sorry, im a totaly Noob with this, i could only programm assambler :ugeek:

PS. how i could send CAN-Commands to the Controller? e.g. to chance the recuperation strength
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Help with CAN

Post by doobedoobedo »

So back on candlelight.
Output as seen by the arduino one byte per line in HEX:

Code: Select all

Received packet with id 0x601 and length 8
22
00
20
08
00
00
00
00
Received packet with id 0x581 and length 8
43
00
20
08
80
00
00
00
Same message sent as before - request for syncofs sent from PC to brain board. So same bytes in the same order as seen by candump.

syncofs is 2500 -> in HEX 0x9C4 -> binary 0b100111000100

For ease of reference the wiki page is here https://openinverter.org/wiki/CAN_commu ... rs_via_SDO

I just don't understand what I'm missing
1) why are bytes 2 and 3 appearing to be swapped? in ProcessSDO it appears to recognise it as 0x2000.
2) Is it something to do with the FOC branch?
3) is the sub index wrong? (eg. I don't have 'boost' returned by the list command)
User avatar
dima
Posts: 157
Joined: Sun Dec 09, 2018 9:35 pm
Location: Canada

Re: Help with CAN

Post by dima »

doobedoobedo wrote: Thu Aug 08, 2019 4:13 pm WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.netbeans.ProxyURLStreamHandlerFactory (file:~/CAN/cantact/platform/lib/boot.jar) to field java.net.URL.handler
WARNING: Please consider reporting this to the maintainers of org.netbeans.ProxyURLStreamHandlerFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
https://stackoverflow.com/questions/468 ... -on-debian
Jack-Lee wrote: Thu Aug 08, 2019 6:56 pm -CanID : 001
-Position : 1
-Bits : 16
-Gain : 1
-Map to Can TX

Code: Select all

can tx version 001 0 16 1
To send to: RX from inverter perspective - Your PC (TX) -> Main Board (RX)

Code: Select all

can rx syncofs 601 0 16 32
Post Reply