|
Forum Index : Microcontroller and PC projects : CANBUS CRC etc
| Author | Message | ||||
| retepsnikrep Senior Member Joined: 31/12/2007 Location: United KingdomPosts: 134 |
I'm working on a microcontroller project that might eventually get transferred to a micromite but I am struggling to understand a CANBUS crc and security type code formulae. I sampled some repeating CANBUS data from a working system. I'm wondering how the two bytes at the end of the packet are generated. I assume the last is a CRC and the penultimate one some sort of security check as it may not be data related. Any leads would be appreciated. Sadly polynomials is not my strong point. ID,D1,D2,D3,D4,D5,D6,D7,D8 203,0,0,0,0,0,0,0,9A 203,0,0,0,0,0,0,20,2F 203,0,0,0,0,0,0,1D,7E 203,0,0,0,0,0,0,0,8B 203,0,0,0,0,0,0,20,10 203,0,0,0,0,0,0,1D,6F 203,0,0,0,0,0,0,0,B8 203,0,0,0,0,0,0,20,1 203,0,0,0,0,0,0,1D,50 203,0,0,0,0,0,0,0,A9 203,0,0,0,0,0,0,20,3E 203,0,0,0,0,0,0,1D,41 203,0,0,0,0,0,0,0,9A 203,0,0,0,0,0,0,20,2F 203,0,0,0,0,0,0,1D,7E 203,0,0,0,0,0,0,0,8B 203,0,0,0,0,0,0,20,10 203,0,0,0,0,0,0,1D,6F 203,0,0,0,0,0,0,0,B8 203,0,0,0,0,0,0,20,1 203,0,0,0,0,0,0,1D,50 203,0,0,0,0,0,0,0,A9 203,0,0,0,0,0,0,20,3E 203,0,0,0,0,0,0,1D,41 203,0,0,0,0,0,0,0,9A 203,0,0,0,0,0,0,20,2F 203,0,0,0,0,0,0,1D,7E 203,0,0,0,0,0,0,0,8B 203,0,0,0,0,0,0,20,10 203,0,0,0,0,0,0,1D,6F 203,0,0,0,0,0,0,0,B8 203,0,0,0,0,0,0,20,1 203,0,0,0,0,0,0,1D,50 203,0,0,0,0,0,0,0,A9 203,0,0,0,0,0,0,20,3E 203,0,0,0,0,0,0,1D,41 203,0,0,0,0,0,0,0,9A 203,0,0,0,0,0,0,20,2F 203,0,0,0,0,0,0,1D,7E 203,0,0,0,0,0,0,0,8B 203,0,0,0,0,0,0,20,10 and a bit more with some data. 203,24,62,46,24,72,47,20,3C 203,24,92,46,24,72,47,2B,4D 203,24,A2,4B,0,0,0,0,99 203,24,62,46,24,72,46,20,2E 203,24,92,46,24,72,46,2B,7B 203,24,92,4D,0,0,0,0,89 203,24,42,44,24,72,44,20,15 203,24,92,44,24,72,4A,2B,6A 203,24,C2,4C,0,0,0,0,B4 203,24,22,42,24,62,3F,20,1 203,24,92,42,24,62,4F,2B,59 203,25,32,4B,0,0,0,0,AE Gen1 Honda Insights. |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
Hello Peter. I have had this link for some time in my favourites: https://www.can-cia.org/can-knowledge/can/crc/ Is the data above raw (i.e. direct readings from CANHI/CANLO) or off an interface IC e.g. mcp2551? The reason I ask is as far as I understand, the CAN data doesn't fit neatly into bytes (11 bit IDs, 29bit frames etc.) I could very easily be wrong here though. https://en.wikipedia.org/wiki/CAN_bus#Data_frame |
||||
| retepsnikrep Senior Member Joined: 31/12/2007 Location: United KingdomPosts: 134 |
Its from an interface and can analyser. Gen1 Honda Insights. |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
OK, so it is possible that pre-processing has been done. TBH I am out of my depth with CAN having never pursued any research. It was something that I wanted to play with (not for automotive, RFID readers in airports) but for my needs there are better ways. I have a mcp2551 break-out board which I've had for years - you can have it if you want to play at a raw level - which might eliminate any fiddling done by the analyser(?) No charge, just PM me with an address and I'll pop it in the post if you interested. Beyond that I can't really help. my CAN aspirations got sidelined and I have never needed to pick up on them. h |
||||
| Boppa Guru Joined: 08/11/2016 Location: AustraliaPosts: 816 |
It would be interesting to see if a canbus adapter for trailers could be done with a micromite, I have been having issues with a trailer plug that has a nice little disco effect on led trailer lights with the dealer supplied adapter, one apparent cure is to fit a ford canbus adapter to it instead, but the adapter costs approximately the same price as 3 of the box trailers its being plugged into! (over $1400 from ford!) |
||||
| retepsnikrep Senior Member Joined: 31/12/2007 Location: United KingdomPosts: 134 |
Ok a slightly different problem. The canbus sends me the following hex data from a battery management system. Just to summarise the 12 bit hex voltage data obtained from the 10 cell HCH Lithium BMS. I have grouped it as required. The test voltages I used are not 100% accurate but should be pretty near the number quoted below. e.g. 4v quoted could be 3.95 or 4.05 etc etc 4v per cell 9DD,9E2,9DF,9E2 9E4,9E3,9E5,9E7 9F0,9EA 3v per cell 756,75C,75A,75C 75C,75E,760,761 76B,764, 2v per cell 4D2,4D2,4D2,4D4 4D7,4D2,4D4,4D3 4D7,4D6 1v per cell 246 246 247 246 249 246 247 246 249 24D 0V = 0v per cell (Some leakage and noise here) 0D0,0D4,0C1,0E2 0DE,0E6,0FC,0E3 0C5,0E7 So the question.. How do we get the cell voltage from the above hex data? Formulae.. Gen1 Honda Insights. |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
as an aside, this just dropped in my mailbox: https://www.microchipdirect.com/product/search/all/APGDT002?mkt_tok=eyJpIjoiWkRKaVl6UmxNRGRsWkROayIsInQiOiJQWmNXVys4alZH R2R6ZkZtbzB1RHpGSTczV2c2MVhpQnFvRklUWkVheDNHVVlIa0RNNkhyeDdPSE4wODRVM1phRW5PY0hkeFdZOXlSS0IwcGxpdGZJcm5YdDE1RndHT0FyNG1Q NDFQWjU4RjhMMnN6RWlSK0MwMEtUQ056WFhQbyJ9 |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4126 |
Ouch - that's expensive! You could use a very cheap Arduino. Or any of a few cheap alternatives. Heck, an elm327 would do at a pinch. In terms of formulae, others have often been there so if you hunt on the net may find help for whatever the mystery source is. John |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |