Page 1 of 2

Help with CAN

Posted: Sat Jul 06, 2019 9:08 pm
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

Re: Help with CAN

Posted: Sun Jul 07, 2019 8:56 am
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.

Re: Help with CAN

Posted: Mon Jul 08, 2019 5:32 pm
by Jack-Lee
Hi,
i have my problems with "Position" and "Bits". What exactly i should write in the boxes?
Bits = 8 , Position = ?

Re: Help with CAN

Posted: Mon Jul 08, 2019 6:29 pm
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

Re: Help with CAN

Posted: Tue Jul 09, 2019 4:11 pm
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.

Re: Help with CAN

Posted: Tue Jul 09, 2019 6:01 pm
by johu
two bits

Re: Help with CAN

Posted: Wed Jul 10, 2019 4:54 am
by Jack-Lee
And the "Position"? They couldnt mean bit 2, when Thema Information is one Byte long.

Re: Help with CAN

Posted: Wed Jul 10, 2019 5:59 am
by johu
Yes it's bits. Why don't you just experiment and see what happens. Nothing can break.

Re: Help with CAN

Posted: Wed Jul 10, 2019 1:42 pm
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.

Re: Help with CAN

Posted: Wed Jul 10, 2019 2:18 pm
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.

Re: Help with CAN

Posted: Wed Jul 10, 2019 4:00 pm
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

Re: Help with CAN

Posted: Wed Jul 10, 2019 5:29 pm
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)

Re: Help with CAN

Posted: Wed Jul 24, 2019 3:50 am
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

Re: Help with CAN

Posted: Thu Jul 25, 2019 7:11 am
by Jack Bauer
Looks great:)

Re: Help with CAN

Posted: Thu Jul 25, 2019 12:03 pm
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/

Re: Help with CAN

Posted: Thu Jul 25, 2019 1:02 pm
by johu
Nice work! So does the web interface somehow communicate over CAN? Because you're mentioning the adapter

Re: Help with CAN

Posted: Thu Jul 25, 2019 3:44 pm
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 :)

Re: Help with CAN

Posted: Thu Aug 08, 2019 12:15 pm
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

Re: Help with CAN

Posted: Thu Aug 08, 2019 3:25 pm
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)
...

Re: Help with CAN

Posted: Thu Aug 08, 2019 3:51 pm
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/

Re: Help with CAN

Posted: Thu Aug 08, 2019 4:13 pm
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

Re: Help with CAN

Posted: Thu Aug 08, 2019 5:34 pm
by doobedoobedo
re-flashed the adaptor and same error.

Re: Help with CAN

Posted: Thu Aug 08, 2019 6:56 pm
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

Re: Help with CAN

Posted: Thu Aug 08, 2019 7:14 pm
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)

Re: Help with CAN

Posted: Thu Aug 08, 2019 7:44 pm
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