12-28-2007 05:38 PM
12-28-2007 05:38 PM
12-28-2007 05:39 PM
12-28-2007 05:39 PM
12-28-2007 06:17 PM
Marshall R,
Thanks for replaying.
I am trying to flash an ECU. the transmit ID is 0x4f0, and the receive ID is 0x4f1
The flashing steps are as follows
1)Initialize Download-->Send a message 0x913480FFFF88BE,and get positive respond message 0x917480FFFF88BE which indicate that initialize download success. The Last two byte 88BE is the checksum of the 22 flames message that i will send in step 2, to tell ECU that 88BE is the value of checksum that ECU should get when ECU itself will calculate the checksum of 22 flames.
2)download-->In this step, i need to send all 22 flames of message to ECU. The ECU will only give a positive respond once 22 flames has been finish written. The positive respond would be 0x9176FFFFFFFFFFFF from the ECU,indicate that 22 flames has been received successfully.
3)End of Transfer---> after getting positve respond from ECU (0x9176FFFFFFFFFFFF), i need to send a message to tell ECU that i have finished sending all the data, and then the ECU will calculate checksum of the receive data. Return a message whether the calculated checksum match with the checksum that i send in step 1. But,in my case the ECU calculated checksum of zero. i am wondering would it be that the ECU has interpreted the 22 flames data all are zero? or maybe empty data of 22 flames?
For my understand, if trying to ncRead a respond from bus, but the ECU still not yet respond. Therefore,ncRead will get the previous respond only,until the ECU respond. That why during step 2, i am trying to get the positive respond from ECU, but it will return 2 message of previous respond ( step 1 respond: 0x917480FFFF88BE ), then will receive the desire respond ( 0x9176FFFFFFFFFFFF ).
During sending the 22 flames, the ECU will would no give any respond until the 22th flame send to ECU. my colleague use labview to flash the ECU,it works very well.Even after finish sending all 22 flames of data, the ECU will immediately send a postivie respond. For me,i am trying to use VB6.0,but it doesn`t perform well for sending the 22 flames of data.
Thanks,
yeoh
12-31-2007 04:38 PM - edited 12-31-2007 04:39 PM
01-01-2008 07:46 AM
01-02-2008 09:25 AM
Hi,
I had a look to your code and here is what i found:
Your Read Object is configured with a specific timeout period of 10 seconds (NC_DURATION_10SEC). That means you could run into a timeout error if you do not receive a frame within a 10 econd period. You should configure the period to 0 (NC_DURATION_NONE) to avoid this situation for your read object.
Your Write object writes periodic every second (NC_DURATION_1SEC). That would need 22 seconds for your 22 message download. You could configure it faster, every 10 ms for example(NC_DURATION_10MS) but you would need to configure a write queue for at least 22 frames, to not overwrite messages by accident. (AttrIdList(6) = NC_ATTR_WRITE_Q_LEN, AttrValueList(6) = 22)
Then you wrote that you need to initiate the download by writing a frame and read the response, but before you do that there is a wait and read function. Is there any reason for this additional read?
For your Initialize process i would remove the sleep and wait for the ECU to respond using the wait function. Then i guess you would need one read only, or doi you expect more then one message to arrive?
Status = ncWrite(TxHandle, Len(Transmit), Transmit)
If (CheckStatus(Status, "ncWrite") = True) Then GoTo Error
Status = ncWaitForState(RxHandle, (NC_ST_READ_AVAIL Or NC_ST_ERROR), 10000, State)
If (CheckStatus(Status, "ncWaitForState") = True) Then GoTo Error
The same for your download and read response. Now that your object is sending the frames every 10 ms you should get your response after 2 seconds or earlier.
Next y
Status = ncWaitForState(RxHandle, (NC_ST_READ_AVAIL), 5000, State)
If (CheckStatus(Status, "ncWaitForState") = True) Then GoTo Error
Status = ncRead(RxHandle, Len(Receive), Receive)
If (CheckStatus(Status, "ncRead") = True) Then GoTo Error
I didn't see any write for your end message and read of the checksum, but i guess you are still working on it?
Good Luck and a happy new year.
DirkW