Post Go back to editing

Flash/EE Programming via LIN Communication- ADuCM330

Hello!

I am  using ADuCM330 for my project and currently I need to download firmware into the flash memory by using LIN communication. I already studied the application note " AN-946 Application Note" but still it's very hard to grasp its whole concept for a beginner like me. 

Can anyone please send me an example code which is related to flash download via LIN communication. I just need to understand the concept so even if the MCU is different, it would be fine for me.  

Regards!

  • Hello,

    in order to perform a Flash/EE Programming via LIN Communication, you require a LIN Transceiver tool which follows the LIN download protocol 6:

    1. Serial Downloader "USB-I2C/LIN-CONV-Z" for I2C and LIN with LINMWSD required to download code to ADuCM33x devices. ADI can provide latest Version of LINMWSD executable.

    http://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/USB-I2C_LIN-CONV-Z.html#eb-overview

    2. Vector CANoeRegistered system with LIN downloader for protocol 6

       ADI can provide latest Version of CANoe downloader file.

    regards,

    Holger

  • Hello,

    the LIN download is handled by the on-chip Kernel.

    For details please refer to the Kernel section in the Hardware Reference Manual starting on page 25.

    http://www.analog.com/media/en/technical-documentation/user-guides/ADuCM330_331_UG-716.pdf

    regards

    Holger

  • Dear Mr. Holger! Thanks for you reply. 

    In our case we have Vector Canoe system with LIN downloader for protocol 6.

    My question is related to the code inside the MCU for LIN downloading. Does we need to code the MCU for firmware downloading through LIN or we  just attach the LIN downloader and it automatically download the code?

  • Also can you please send me the link of latest version of CANoe downloader file for LIN download of ADuCM330. 

  • Hello

    find attached the latest version of the ADuCM33x CANoe downloader.

    regards

    Holger

  • Thanks alot Mr. Holger for your quick response. I made a small mistake in my previous reply. Actually we had a lower version ( 7.6 SP2) of Canoe and the above file can only work on versions higher than 8.2.

    Is it possible for you to send a file for version 7.6. ?

    Thanks alot for your help. 

  • Dear Mr. Holger! 

    Please reply back if there is a possibility for you to provide LIN_download code of Canoe version 7.6.4 SP2. 

  • Hello,

    The CANoe tool was developed for ADI by an external contractor. I am not a CANoe expert and I am therefore not in a position to check you tool modification.

    Kernel functionality: when page 0 is erased and a reset has been performed, the Kernel will enter the LIN downloader which only accepts Protocol 6 communication.

    Any other LIN communication will be ignored, this might be the reason why the CANoe tool reports "slave is not responding".

    regards

    Holger

  • Dear Mr. Holger!

     In our code,  I have done the setting of LIN such that whenever it receives LIN ID=3C with [ 7F 06 B2 00 3A 00 31 4D] frame values, the code transmits  [ 7F 06 B2 00 3A 00 31 4D] frame back and then enters flash erase block and erase the first flash page at address (0x000000) and performs the software reset as shown below:

    ///       LIN Block Setting

    if(LINID == 0x3C) 
    {

    LINCNT = 0x8;
    Rx_Frame[0] = LIND1;
    Rx_Frame[1] = LIND2;
    Rx_Frame[2] = LIND3;
    Rx_Frame[3] = LIND4;
    Rx_Frame[4] = LIND5;
    Rx_Frame[5] = LIND6;
    Rx_Frame[6] = LIND7;
    Rx_Frame[7] = LIND8;
    if (Rx_Frame[0]==0x7F){
    if (Rx_Frame[1]==0x06){
    if (Rx_Frame[2]==0xB2){
    if(Rx_Frame[4]==0x3A){

    LIND1= 0x7F;
    LIND2= 0x06;
    LIND3=0xF2;
    LIND4=0x3A;
    LIND5=0x00;
    LIND6=0x31;
    LIND7=0x4D;
    LIND8=0x00;

    LINCON |= 0x03; 

    Flash_LIN_Update_Start ();
    }
    }
    }
    }
    }

    //   Flash Erase Block

     

    void Flash_LIN_Update_Start (void)
    {

    FLASH_Page_Erase (0x000000 );
    AIRCR=0x05FA0004;  // for software reset 
    while(1) {}
    }

    // Flash Erase Page

    void FLASH_Page_Erase (unsigned int nAddress )
    {
    unsigned int uiSTA;
    FEEKEY = 0xF456; // Enter Keys
    FEEKEY = 0xF123;
    FEEADR1L = nAddress;
    FEECMD = 0x1; // Flash erase page command
    do{
    do{
    uiSTA = FEESTA;
    }while(uiSTA & 0x1); // Wait until not busy
    }while( ! (uiSTA & 0x4)); // Ensure command completed
    }

    Is this sequence accurate.?

    Currently I am using Canoe Code for Protocol 6 ( specially designed for ADuC7038). I modified canoe code a little bit so that it send  [ 7F 06 B2 00 3A 00 31 4D]  frame as a master request. The Canoe file is also attached.

    Whenever i send a request from canoe, the MCU works and erase the page 0 and reset as well but on canoe side i get an error that slave is not responding. Can you please check that where is the error.?

    Can you please check the canoe file as well to verify that it is working accurately or not.?

  • Dear Mr. Holger! 

    Thanks for your response. 

    I can understand that Canoe is a separate tool. Last time you send me a Canoe file which can only work on versions higher than 8.2. 

    Can you provide that same file with lower version, if possible.?

    Thanks alot.!