08-07-2018 12:32 AM - edited 08-07-2018 12:36 AM
Hi,
I have a little problem with flash programming with XNET. Generally the programming works with a NI 9862 and the Automotive Diagnostic Command Set. However, this is pretty slow compared to other tools.
Of course, I checked settings like the baud rate... any ideas?
08-08-2018 08:02 AM
Hi,
Could you describe bit more in detail what are you trying to achieve? Any piece of code or screenshot would be helpful to see.
Thanks!
08-09-2018 01:34 AM
This is the core part where the flash memory is programmed. The procedure is implemented as described in standard VW80126 - UDS compliant programming of ECUs.
08-10-2018 08:50 AM
Hi,
please let me know, what is slow exactly in this case.
The "flash" global variable is updated slowly, or the whole loop is iterating slowly?
Which tools are you comparing it to?
Thanks
08-11-2018 12:56 PM
Two issues I see.
The wait is not needed. The data transfer will time the loop better.
The select and associated shift register is just silly. Replace with i mod(0xFF). In range and coerce, use remainder.
08-13-2018 02:35 AM
Thank you for the hints. Programming takes 107s with Labview and 23s with vFlash from Vector. This does not change after the consideration of the hints.
I have recorded a CAN trace. There I can see my and the reference tool send and receive the same messages. But the time increases during my loop much more than with the reference tool. Maybe the communication VI (Diagnostic Service.vi -> in the picture marked with "TransferData") is a little bit slow?! Unfortunately I can't look into the password protected VI.
08-13-2018 10:31 AM - edited 08-13-2018 10:37 AM
This likely has to do with your code, but there is the possibility that NI could optimize things. I've replicated vFlash process using UDS writes and ISO 15765 and I've been able to get a flash operation to take place within a couple seconds of vFlash. Try removing all unnecessary code to the flashing process. This means removing progress bar updates, and cancel checking just temporarily. Also disable debugging, and automatic error handling, and inline VIs that you can. Now look at the execution time. You should be on par with what vFlash does. Now slowly add feature and see what is taking extra time. I suspect that you'll get better performance if you choose to only do things like check for cancel, and update progress once a second or so. I'd also suggest using Split 1D array, instead of getting various array subsets each time. Here is a quick example of something similar, note this isn't a snippet.
Note that here each segment is 2048 bytes, and our block sequence counter goes from 1, to FF to 0 just like yours. I do have a retry, but I think it is legacy and isn't needed. We keep splitting away 2048 bytes until there isn't any left. We also check once a second for cancel (queue reference destroyed) and if it isn't then we update the progress once a second. The bottom tunnel is the total number of bytes to transfer. There is no need for a wait, and even a wait 0 is not needed. This is because the delays will be defined by the ISO15765 protocol and the ECU will state how much of a delay between frames is needed. And bonus no globals and wireless programming.
Oh and the password protected VIs aren't interesting. They just call NI DLLs that do the heavy lifting. Of course if you want to implement the ISO 15765 protocol on your own in pure G you can use my code from Part 8 of my CAN blog.
I've drafted a CAN blog post on ISO 15765 flashing, and XCP/CCP but just haven't had time to finish it,
which would cover some of this.
And one more edit, why not. If you are looking for more support on XNet and CAN you may find that posting on the Automotive subforum will get more attention from those dedicated to the subject. The general LabVIEW forum gets flooded quite a bit and these dedicated ones might give you more attention.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-14-2018 12:38 AM
Thank you Hooovahh for your answer!
I continue this topic in the automotive section.
06-20-2024 11:50 PM
Can you please share this vi?
06-26-2024 12:23 PM
@r94 wrote:
Can you please share this vi?
If you are referring to what I posted, I can't really share it. What I showed really is just one VI but each ECU may have a different steps in flashing. I was really just trying to show the core of it, where data transfer is taking place since that is where any small delay can be amplified, since the code will be there the most. Before this you'll need to set the address, and maybe run erase or CRC checking routines that are specific to the ECU.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord