hat hier schon einmal jemand mit CAN rumgespielt? ich hab da eine blackbox die CAN spricht und will rausfinden was passiert. ich hab eh schon einiges gelesen und videos dazu angesehen, aber vielleicht liest hier ja jemand mit der sowas täglich macht. :* -flo
servus! ich hab hier noch einen CAN-USB-stick rumliegen, mit dem ich mal ein projekt mit motorsteuerungen gemacht hab: https://dcmotion.de/interfaces/mican-stick.html damals hab ich nur die software von miControl verwendet (sind jetzt scheinbar teil von Apex Systeme Gmbh). damit kannst Du das ding vielleicht analysieren: https://dcmotion.de/mplc.html LG Zwax Am 30.09.21 um 21:20 schrieb overflo via Metalab:
hat hier schon einmal jemand mit CAN rumgespielt?
ich hab da eine blackbox die CAN spricht und will rausfinden was passiert. ich hab eh schon einiges gelesen und videos dazu angesehen, aber vielleicht liest hier ja jemand mit der sowas täglich macht.
:* -flo
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
Hi, Back in the days my homeautomation was based on CAN bus. There was a lot of arduinos and some RPIs involved. I have good experiences with those noname chinese SPI based CAN controllers and drivers. --Endre On Fri, Oct 01, 2021 at 09:43:32+0200, Zwax via Metalab wrote:
servus!
ich hab hier noch einen CAN-USB-stick rumliegen, mit dem ich mal ein projekt mit motorsteuerungen gemacht hab: https://dcmotion.de/interfaces/mican-stick.html
damals hab ich nur die software von miControl verwendet (sind jetzt scheinbar teil von Apex Systeme Gmbh). damit kannst Du das ding vielleicht analysieren: https://dcmotion.de/mplc.html
LG Zwax
Am 30.09.21 um 21:20 schrieb overflo via Metalab:
hat hier schon einmal jemand mit CAN rumgespielt?
ich hab da eine blackbox die CAN spricht und will rausfinden was passiert. ich hab eh schon einiges gelesen und videos dazu angesehen, aber vielleicht liest hier ja jemand mit der sowas täglich macht.
:* -flo
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
Yes, I’m a CAN expert. Ask me anything. My latest CAN project: http://actvr.com/ For CAN hacking in general I recommend the m5stack: http://m5stack.com/ See also: CanOpen ; -- seclorum
On 01.10.2021, at 09:48, Endre Szabo via Metalab <metalab@lists.metalab.at> wrote:
Hi,
Back in the days my homeautomation was based on CAN bus. There was a lot of arduinos and some RPIs involved. I have good experiences with those noname chinese SPI based CAN controllers and drivers.
--Endre
On Fri, Oct 01, 2021 at 09:43:32+0200, Zwax via Metalab wrote: servus!
ich hab hier noch einen CAN-USB-stick rumliegen, mit dem ich mal ein projekt mit motorsteuerungen gemacht hab: https://dcmotion.de/interfaces/mican-stick.html
damals hab ich nur die software von miControl verwendet (sind jetzt scheinbar teil von Apex Systeme Gmbh). damit kannst Du das ding vielleicht analysieren: https://dcmotion.de/mplc.html
LG Zwax
Am 30.09.21 um 21:20 schrieb overflo via Metalab: hat hier schon einmal jemand mit CAN rumgespielt?
ich hab da eine blackbox die CAN spricht und will rausfinden was passiert. ich hab eh schon einiges gelesen und videos dazu angesehen, aber vielleicht liest hier ja jemand mit der sowas täglich macht.
:* -flo
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
ohai
Yes, I’m a CAN expert. Ask me anything.
cool! so i read there are different CAN standards. CAN supports different bitrates and communication speeds. i am dealing with a blackbox without documentation. i got myself a MCP2515 (SPI interfaced CAN transceiver). i can talk to it over SPI and i get SOME data on the CAN lines i am trying to debug. the relevant callback-function to print that data looks like this: void onReceiveBufferFull(uint32_t const timestamp_us, uint32_t const id, uint8_t const * data, uint8_t const len) { Serial.print("[ "); Serial.print(timestamp_us); Serial.print("] "); Serial.print("ID"); if(id & MCP2515::CAN_EFF_BITMASK) Serial.print("(EXT)"); if(id & MCP2515::CAN_RTR_BITMASK) Serial.print("(RTR)"); Serial.print(" "); Serial.print(id, HEX); Serial.print(" DATA["); Serial.print(len); Serial.print("] "); std::for_each(data, data+len, [](uint8_t const elem) { Serial.print(elem, HEX); Serial.print(" "); }); Serial.println(); } some IDs have an EFF flag set, some not. i dont know what that is yet. here is some example raw data i captured. [ 6615006] ID(EXT) 9FFFADE0 DATA[0] [ 6619811] ID(EXT) 9FF5BC1F DATA[0] [ 12934718] ID(EXT) 8B783EA0 DATA[0] [ 48995318] ID(EXT) 9783EA00 DATA[0] [ 57706446] ID(EXT) 983EA000 DATA[0] [ 392002959] ID 200 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392013566] ID 6DF DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392018774] ID 188 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392023796] ID 3C8 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392028621] ID(EXT) 843C8DB7 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392033812] ID(EXT) 8DB7C360 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 402711072] ID(EXT) 9B7C3600 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 404050719] ID(EXT) 97C36000 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425640295] ID(EXT) 9C360000 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425651260] ID(EXT) 80000DB7 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425656204] ID(EXT) 80DB7DB7 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425661425] ID 188 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425666297] ID 6DF DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425671443] ID(EXT) 96FEC3A0 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC i initalize the transceiver like this: mcp2515.setBitRate(CanBitRate::BR_250kBPS_16MHZ); there are different modes to initalize it: BR_125kBPS_16MHZ = 0, BR_250kBPS_16MHZ = 1, BR_500kBPS_16MHZ = 2, BR_1000kBPS_16MHZ = 3, BR_125kBPS_8MHZ = 4, BR_250kBPS_8MHZ = 5, BR_500kBPS_8MHZ = 6, BR_1000kBPS_8MHZ = 7 Questions: - would i read ANY (wrong/different) data if i get the bitrate setting part wrong? - is there a reliable way to find out the correct bitrate used in the blackbox system? - what is a good way to debug the captured data - any recommandantions for FOSS software (linux) ? - any recommandations on books/papers/videos worth reading/watching? :* -flo
ohai
Yes, I’m a CAN expert. Ask me anything.
cool! so i read there are different CAN standards. CAN supports different bitrates and communication speeds. i am dealing with a blackbox without documentation. i got myself a MCP2515 (SPI interfaced CAN transceiver). i can talk to it over SPI and i get SOME data on the CAN lines i am trying to debug. the relevant callback-function to print that data looks like this: void onReceiveBufferFull(uint32_t const timestamp_us, uint32_t const id, uint8_t const * data, uint8_t const len) { Serial.print("[ "); Serial.print(timestamp_us); Serial.print("] "); Serial.print("ID"); if(id & MCP2515::CAN_EFF_BITMASK) Serial.print("(EXT)"); if(id & MCP2515::CAN_RTR_BITMASK) Serial.print("(RTR)"); Serial.print(" "); Serial.print(id, HEX); Serial.print(" DATA["); Serial.print(len); Serial.print("] "); std::for_each(data, data+len, [](uint8_t const elem) { Serial.print(elem, HEX); Serial.print(" "); }); Serial.println(); } some IDs have an EFF flag set, some not. i dont know what that is yet. here is some example raw data i captured. [ 6615006] ID(EXT) 9FFFADE0 DATA[0] [ 6619811] ID(EXT) 9FF5BC1F DATA[0] [ 12934718] ID(EXT) 8B783EA0 DATA[0] [ 48995318] ID(EXT) 9783EA00 DATA[0] [ 57706446] ID(EXT) 983EA000 DATA[0] [ 392002959] ID 200 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392013566] ID 6DF DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392018774] ID 188 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392023796] ID 3C8 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392028621] ID(EXT) 843C8DB7 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 392033812] ID(EXT) 8DB7C360 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 402711072] ID(EXT) 9B7C3600 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 404050719] ID(EXT) 97C36000 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425640295] ID(EXT) 9C360000 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425651260] ID(EXT) 80000DB7 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425656204] ID(EXT) 80DB7DB7 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425661425] ID 188 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425666297] ID 6DF DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC [ 425671443] ID(EXT) 96FEC3A0 DATA[12] 0 0 0 0 0 0 0 0 D3 92 5A AC i initalize the transceiver like this: mcp2515.setBitRate(CanBitRate::BR_250kBPS_16MHZ); there are different modes to initalize it: BR_125kBPS_16MHZ = 0, BR_250kBPS_16MHZ = 1, BR_500kBPS_16MHZ = 2, BR_1000kBPS_16MHZ = 3, BR_125kBPS_8MHZ = 4, BR_250kBPS_8MHZ = 5, BR_500kBPS_8MHZ = 6, BR_1000kBPS_8MHZ = 7 Questions: - would i read ANY (wrong/different) data if i get the bitrate setting part wrong? - is there a reliable way to find out the correct bitrate used in the blackbox system? - what is a good way to debug the captured data - any recommendations for FOSS software (linux) ? - any recommendations on books/papers/videos worth reading/watching? :* -flo
Hi Flo!
some IDs have an EFF flag set, some not. i dont know what that is yet.
Extended frames use more bits for the address (iirc 11 bit vs 29 bit).
- would i read ANY (wrong/different) data if i get the bitrate setting part wrong?
I have no experience with that but I'd guess not as CAN has checksums for messages to detect errors during transmission. This would make receiving "random" messages due to a wrong bitrate very unlikely.
- is there a reliable way to find out the correct bitrate used in the blackbox system?
Using a scope is definitely one way I did it before (by measuring the bit timings. Some scopes can even detect the bitrate and decode the CAN packets on the fly).
- any recommendations for FOSS software (linux) ?
I'm using SavvyCAN. It's a bit clumsy to use and unstable at times but it's a very powerful piece of software. I couldn't answer all your questions but I hope I could help a bit :P LG Jakob
ohai
Extended frames use more bits for the address (iirc 11 bit vs 29 bit).
aaaaah!
- would i read ANY (wrong/different) data if i get the bitrate setting part wrong?
no, the bitrate settings are important, a wrong bitrate gives wrong CRC and no data at all.
I have no experience with that but I'd guess not as CAN has checksums for messages to detect errors during transmission. This would make receiving "random" messages due to a wrong bitrate very unlikely.
tested, true.
- is there a reliable way to find out the correct bitrate used in the blackbox system? Using a scope is definitely one way I did it before (by measuring the bit timings. Some scopes can even detect the bitrate and decode the CAN packets on the fly).
the one i used at first try worked :)
- any recommendations for FOSS software (linux) ? I'm using SavvyCAN. It's a bit clumsy to use and unstable at times but it's a very powerful piece of software.
coooool! pretty much exactly what i need!
I couldn't answer all your questions but I hope I could help a bit :P
youme helped a lot! thank you very much :* -flo
ohai, ich schon wieder mit CAN. hat hier jemand einen logic analyzer der CAN kann? oder ein oszi mit eingebautem CAN-decoder support? Ich SEHE die CAN pakete, und ich *GLAUBE* dass die bitrate bei 200kBps ist, aber ich bekomme mit meiner MCP2515 hardware keine daten. Schritt 1 ist nun mal die korrekte Bitrate rausfinden. Ich hab mir mit dem MCP2515 einen sender gemacht der bei 250kBps sendet und das liefert mir eine stabile Frequenz von 62.5 Hz Das Signal das ich lesen will kommt mit 50 Hz rein ist also laut Schlussrechnung bei 200 kBps daheim. Tut aber nicht. Wie geh ich das an? Ja der Bus ist korrekt terminiert imt 120 Ohm Wiederständen. :* -flo
ich hab ein high end oszi gefunden dass CAN kann. werde das mal morgen genauer ansehen. gute nacht. :* -flo On 20/10/2021 15:43, overflo via Metalab wrote:
ohai,
ich schon wieder mit CAN.
hat hier jemand einen logic analyzer der CAN kann? oder ein oszi mit eingebautem CAN-decoder support?
Ich SEHE die CAN pakete, und ich *GLAUBE* dass die bitrate bei 200kBps ist, aber ich bekomme mit meiner MCP2515 hardware keine daten.
Schritt 1 ist nun mal die korrekte Bitrate rausfinden.
Ich hab mir mit dem MCP2515 einen sender gemacht der bei 250kBps sendet und das liefert mir eine stabile Frequenz von 62.5 Hz Das Signal das ich lesen will kommt mit 50 Hz rein ist also laut Schlussrechnung bei 200 kBps daheim. Tut aber nicht.
Wie geh ich das an?
Ja der Bus ist korrekt terminiert imt 120 Ohm Wiederständen.
:* -flo
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
Hi Flo, On Wed, 20 Oct 2021 13:43:41 +0000 overflo via Metalab wrote:
hat hier jemand einen logic analyzer der CAN kann? oder ein oszi mit eingebautem CAN-decoder support?
Ich SEHE die CAN pakete, und ich *GLAUBE* dass die bitrate bei 200kBps ist, aber ich bekomme mit meiner MCP2515 hardware keine daten.
Schritt 1 ist nun mal die korrekte Bitrate rausfinden.
wieso glaubst Du 200 und nicht 250kBps? Die Datenpakete wären auch am (Speicher-)Oszi ohne Dekodier- funktion zu sehen. Dort kann dann reinzoomen und die Dauer eines schlanken bits messen um auf die Busrate zu kommen.
Ich hab mir mit dem MCP2515 einen sender gemacht der bei 250kBps sendet und das liefert mir eine stabile Frequenz von 62.5 Hz Das Signal das ich lesen will kommt mit 50 Hz rein ist also laut Schlussrechnung bei 200 kBps daheim.
Ich versteh die Schlussrechnung nicht. 62,5 und 50Hz, ist das die Wiederholhäufigkeit eines Datenpakets? (Oder wie oft Du "reinhörst"?) Was hat das mit der kBps Bitrate zu tun?
Tut aber nicht.
Wie geh ich das an?
Ja der Bus ist korrekt terminiert imt 120 Ohm Wiederständen.
Neben der High Speed-Variante gibt es auch noch die Low Speed/ Fault-Tolerant-Variante vom CAN physical layer, wo jedes Device seine eigene Terminierung hat. Die beiden spielen nicht im selben Netzwerk. (Bei NI hab ich noch Single-Wire CAN und Software-Selectable CAN gesehen) lg, Peter
ich hab das mysterium gelöst. also die bitrate ist 250kbps, die diefferenz von 61.5 khz auf 50Hz kann cih mri noch nicht erklären hángt aber scheinbar irgendwie mit dem zoomlevel am RIGOL oszi zusammen. das konnte ich sicherstellen nachdem ich am 20k rohde+schwarz super oszi daten dekodiert habe aber nur auf einem der beiden differentiellen signalleitungen. heute habe ich die leitungen an meinem el-cheapo RIGOL angesteckt und geshen dass die leitungen am PCB flasch beschriftet waren und eine andere leitung CAN_L war als angenommen CAN_H war die die ursrünglich als CAN_L angeschrieben war. lessosns learned: never trust a silkscreen. wer misst, misst mist. jedenfalls hab ich nun mit den korrekten leitungen daten gedumpt! vielen dank an alle mithelfenden menschen, ihr seid toll. ich schick updates sobald klar ist dass das was ich vor habe funktioniert. :* -flo On 21/10/2021 14:35, Peter Kuhm via Metalab wrote:
Hi Flo,
On Wed, 20 Oct 2021 13:43:41 +0000 overflo via Metalab wrote:
hat hier jemand einen logic analyzer der CAN kann? oder ein oszi mit eingebautem CAN-decoder support?
Ich SEHE die CAN pakete, und ich *GLAUBE* dass die bitrate bei 200kBps ist, aber ich bekomme mit meiner MCP2515 hardware keine daten.
Schritt 1 ist nun mal die korrekte Bitrate rausfinden. wieso glaubst Du 200 und nicht 250kBps?
Die Datenpakete wären auch am (Speicher-)Oszi ohne Dekodier- funktion zu sehen. Dort kann dann reinzoomen und die Dauer eines schlanken bits messen um auf die Busrate zu kommen.
Ich hab mir mit dem MCP2515 einen sender gemacht der bei 250kBps sendet und das liefert mir eine stabile Frequenz von 62.5 Hz Das Signal das ich lesen will kommt mit 50 Hz rein ist also laut Schlussrechnung bei 200 kBps daheim. Ich versteh die Schlussrechnung nicht. 62,5 und 50Hz, ist das die Wiederholhäufigkeit eines Datenpakets? (Oder wie oft Du "reinhörst"?) Was hat das mit der kBps Bitrate zu tun?
Tut aber nicht.
Wie geh ich das an?
Ja der Bus ist korrekt terminiert imt 120 Ohm Wiederständen. Neben der High Speed-Variante gibt es auch noch die Low Speed/ Fault-Tolerant-Variante vom CAN physical layer, wo jedes Device seine eigene Terminierung hat. Die beiden spielen nicht im selben Netzwerk.
(Bei NI hab ich noch Single-Wire CAN und Software-Selectable CAN gesehen)
lg, Peter
_______________________________________________ Metalab mailing list Metalab@lists.metalab.at https://lists.metalab.at/mailman/listinfo/metalab
Hi, On Fri, 22 Oct 2021 08:59:23 +0000 overflo via Metalab wrote:
ich hab das mysterium gelöst.
fein wenn sich die Schleier lüften!
also die bitrate ist 250kbps,
also sog. high-speed transmission. Daher soll das an beiden Enden mit 120 Ohm terminiert sein. Mit dem Multimeter mißt mensch am (sonst stromlosen) Netzwerk 60 Ohm.
die diefferenz von 61.5 khz auf 50Hz kann cih mri noch nicht erklären hángt aber scheinbar irgendwie mit dem zoomlevel am RIGOL oszi zusammen.
wie in meiner letzten Mail geschrieben, versteh ich ja die Hz-Angaben noch nicht. Du setzt sie in Zusammenhang mit der Bitrate und Du schriebst von 60.5 Hz, nicht kHz. Kann damit im Bus Kontext nichts anfangen.
das konnte ich sicherstellen nachdem ich am 20k rohde+schwarz super oszi daten dekodiert habe aber nur auf einem der beiden differentiellen signalleitungen.
kannste konfigurieren ob CAN_L oder CAN_H dekodiert werden soll. Es unterscheiden sich die Spannungspegel und die Signale sind invertiert. s.a. https://imgur.com/a/1q62B0m
heute habe ich die leitungen an meinem el-cheapo RIGOL angesteckt und geshen dass die leitungen am PCB flasch beschriftet waren und eine andere leitung CAN_L war als angenommen
CAN_H war die die ursrünglich als CAN_L angeschrieben war.
das hast Du anhand der Level festgestellt? Gegen CAN_GND?
Ich SEHE die CAN pakete, und ich *GLAUBE* dass die bitrate bei 200kBps ist, aber ich bekomme mit meiner MCP2515 hardware keine daten.
Schritt 1 ist nun mal die korrekte Bitrate rausfinden. wieso glaubst Du 200 und nicht 250kBps?
Die Datenpakete wären auch am (Speicher-)Oszi ohne Dekodier- funktion zu sehen. Dort kann dann reinzoomen und die Dauer eines schlanken bits messen um auf die Busrate zu kommen.
vgl.https://en.racelogic.support/VBOX_Motorsport/01General_Information/Knowledge...
Ich hab mir mit dem MCP2515 einen sender gemacht der bei 250kBps sendet und das liefert mir eine stabile Frequenz von 62.5 Hz Das Signal das ich lesen will kommt mit 50 Hz rein ist also laut Schlussrechnung bei 200 kBps daheim.
Ich versteh die Schlussrechnung nicht. 62,5 und 50Hz, ist das die Wiederholhäufigkeit eines Datenpakets? (Oder wie oft Du "reinhörst"?) Was hat das mit der kBps Bitrate zu tun?
cu, Peter
Teilnehmer (6)
-
Endre Szabo -
Jakob Riepler -
Jay Vaughan -
overflo -
Peter Kuhm -
Zwax