Solicited CAN Messages, Anything special required?

Discussion in 'Gen 2 Prius Accessories & Modifications' started by 2k1Toaster, Aug 13, 2012.

  1. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    So I finally rolled past 100K on the odometer when I can put more effort into my EV conversion. I whipped out the board I designed a couple years ago to sniff the CAN messages and it still does that just fine. However I tried to get the advanced solicited messages, and I got nothing.

    I can see my TX being sent and I can see it being received back through the transceiver. So it would appear it is on the bus. And by "see" I mean looking at an oscilloscope I see a waveform produced when I click send.

    Maybe I don't understand the method used in the Prius? If you send a CAN message with an SID of 0x7E3, and 2 data bytes of 0x21 and 0xD0 I would expect another message at a later time from SID 0x7EB with the battery module voltages. I am thinking the message is sent but I am not seeing a response from 0x7EB even with a receive filter set to only 0x7xx addresses.

    Is there something special that has to be done?
     
  2. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,704
    486
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    It looks like you are handling the CAN messages in its "raw" format yourself as opposed to using an ELM compatible chip, right? If so then you need to study the CAN specification to find out the correct format for CAN messages. For example you need to say how many bytes of data you are sending in your query and to send a certain acknowledge message for multi-frame replies.

    This thread may be of interest:
    YAPiP - recreating pEEf's approach | PriusChat
     
  3. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Yes I am dealing with it myself however I am using part of a peripheral library for the microcontroller. I am pretty well versed in how CAN itself works from the physical layer all the way to the protocol itself. Like I said, I have it working for reading messages. That would not be possible without getting the correct time quantas and protocol analyze routines. Also when I send messages, I see it being transmitted.

    I see the start of frame, the SID, the data byte count, the data, and the end of frame as well as the required time wait. I get nothing back the way I would expect.

    That is why I am wondering if I am interpreting the Prius incorrectly. My interpretation is I send out a message to a SID with a couple data bytes set (and of course in the correct SOF/SID/dN/d[0-n]/EOF/I format) and then some time later but within a few hundred milliseconds I should see a message broadcast from another SID with the response.

    Is this incorrect?
     
  4. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,704
    486
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    I think you got it right and so I don't know why there was no response either. What if you don't filter the receiver and watch everything on the bus?
     
  5. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Actually I am filtering it. The board I designed a while back "sniffs" all messages and passes them over a USB connection. I have it working so that I can actually empty the CAN RX buffer meaning I am getting the data over the USB a little faster then the CAN messages are arriving, so I am not missing any message (like overflows). But for testing to make sure I put in the filter for only messages greater than 0x700, and in loopback I could see my message sent properly but when I actually sent it, I got no response.

    I am just hooking into the OBDII port under the dash. I would think if I had some basic error I wouldn't get anything. But I can graph everything passively available on the bus at realtime speeds. Drive around with the laptop and see the HV voltage and current for the pack, door status, everything.

    The Prius just seems to be ignoring my messages...
     
  6. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Well its not ignoring me, something on the bus is actively ACKnowledging the CAN message so it is not errored. I can see it now on another scope and the signal looks great.
     
  7. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
  8. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Also using the scope to trigger on all 0x7xx addresses shows my message but nothing else ever returned...
     
  9. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Looking at one side of the differential line (CANH) I see it transmitted and it is clear that something external (or multiple nodes) are pulling it to acknowledge an error free reception. Just nothing is happening in return.

    [​IMG]
     
  10. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    As an update I can change things in the car, but I still can't get these "solicited messages".

    I can send a 0x529 frame which contains the info to display on the MFD. I can make it display whatever amount of bars I want on the SOC by clicking a button on my laptop. So I know the CAN communication is working.

    There has to be something simple and fundamentally incorrect with my method of getting these other data points.
     
  11. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    403
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    I have written a mmbasic program to get solicited messages from my Second generation Prius and it works. The code is attached in my first post in my thread

    My Duinomite Mega Canview V4 equivalent Project | PriusChat

    It may help you if you read my code mmbasic as it is simple to understand and maybe it may help you to figure out why yours is not working. I guess you probably wrote your code in C or assembly language.
     
  12. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Excellent thankyou.

    I did a quick once over, and it would appear this:

    Code:
      CANSEND &H7E2,0,8,txData(0),txOk
    
    does the dirty work of sending. I am guessing the inputs are CANSEND (SID,RTR(?),DataLength,&Data-index-0, status)?

    From this I gather that you are actually sending 8 bytes of data + all the framing.

    I was interpreting it as send 2 bytes of data, and those are the two bytes. Your code sends 8 bytes of data with 3 data bytes pop'd the others 0'd. Is this correct?

    I will have to go out to car and try this in a few minutes. Good thing I left my scope hooked up and everything!
     
  13. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    403
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    The return frames are returned at different times. I think they are sent when Canbus is not busy as x07XX commands have lower priority than those unsolicited ones.

    I found just sending two bytes of data does not work. Must always send all 8 data bytes.
     
  14. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    Correct. That I knew. And the higher the SID the lower the priority. The more 0's, the more dominant the message, the higher priority on the bus. That's why investigative commands are so high.

    That's the missing piece of the puzzle. CAN allows, and the Prius does, send non 8byte data lengths. The data length of the packets is all over the place depending on the SID.

    So when I saw 0x02 0x21 0x0D, I figured that meant send 0x21 and 0x0D for a total data length of 0x02. But really it is send

    SOF | SID = 0x7E | DLC = 0x8 | 0x02 0x21 0xD0 0x00 0x00 0x00 0x00 0x00 | CRC = 0x214C | ACK | EOF

    [​IMG]

    and then some time later [5.716 milliseconds] I get:

    [​IMG]

    It is interesting to note that there is a lot of bus idle time between. Perhaps the Battery ECU actually does a conversion after the command instead of sending the last known sample?

    [​IMG]
     
  15. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    403
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
  16. 2k1Toaster

    2k1Toaster Brand New Prius Batteries

    Joined:
    Feb 14, 2010
    5,982
    3,781
    0
    Location:
    Rocky Mountains
    Vehicle:
    2006 Prius
    Model:
    Three
    CAN requires a byte to say how bytes follow. If you did not specify it, then your library did somewhere. I am coding this at a much lower level so it is not done for me.
     
  17. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    403
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    On the question of timing can you tell us how long it takes you to get all five return frames after sending the tell me more frame 07 E3 30. I am assuming you are asking ECU number 3. Do you get the return frames coming at different intervals? Can you show us CRO screens for the timing of these frames. Thanks.
     
  18. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,704
    486
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    Dumb question to 2K1: what scope are you using that displays the traces and decodes the CAN messages? Thanks!
     
  19. lopezjm2001

    lopezjm2001 Senior Member

    Joined:
    Apr 14, 2009
    1,146
    403
    5
    Location:
    Sydney Australia
    Vehicle:
    Other Electric Vehicle
    Model:
    N/A
    The scope that he is using shows the frame details so if you can read the frame you can decode the CAN message.
     

    Attached Files:

  20. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,704
    486
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    But it's the scope that is doing the decoding automatically, not the user doing it manually, am I wrong?
     
Loading...