This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM44L920: Bootloader - Use Arbitrary CAN Node

Part Number: RM44L920

I have been using the TI-provided CAN bootloader in a project, where I have two active CAN nodes. The original version of the bootloader is hard coded to use only CAN node 1. I modified it slightly to allow for choosing the node when a software update is initialized - the node to be used is placed in the low nibble of the incorrect magic number by the application and read by the bootloader. This is probably sufficient.

However, it would be preferable if the bootloader used whichever node the initial ping comes in on so the person performing a software update over CAN does not have to think about which channel is being used. The only way I can imagine this working is to add a CAN interrupt to the bootloader, which would include the node the message came in on. 

My question is - is there any way to determine the node that a particular message comes in on without using a CAN interrupt?

Thanks!

- Tom

  • Hi Tom,

    DCAN node does not support node ID. Instead, receivers process messages by means of an acceptance filtering process. All nodes in a DCAN network receive the same message at the same time, but the message filter guarantees that the receiving nodes will only store the received message into their appropriate message objects if the message passes acceptance filtering.

    You can use different message filter settings for the DCAN nodes on the DCAN network.

  • I used "node" in an incorrect manner, when I should have used "port". Node being a particular device on the CAN bus. Sorry about that.

    In the Hercules bootloader CCS project (written by some QJ Wang guy, I think 8^)), git repo linked from SPNA241, `bl_main.c` uses a hard coded value for `CAN_PORT`, defined in `bl_config.h` to be `canREG1`.  I made simple modifications in a few places so that the lowest nibble of the incorrect "magic number" determines which CAN node to use - `canREG1` or `canREG2`.Here are the mods in `bl_main.c`, for example:

    fnRetValue = CheckForceUpdate();
        if (fnRetValue == 2) {
            UART_putString(UART, "\r Using canREG2 for update! \r\n");
        } else {
            UART_putString(UART, "\r Using canREG1 for update! \r\n");
        }
    
        //fnRetValue = 0;  //qj for testing application code
    
        if ( !fnRetValue )
        {
    #ifdef DEBUG_MSG
        	UART_putString(UART, "\r Jump to application...  \r\n");
    #endif
            g_ulTransferAddress = (uint32_t)APP_START_ADDRESS;
            ((void (*)(void))g_ulTransferAddress)();
        }
    
        //
    	//  Configure the microcontroller.
    	//
    	//EnterBootLoader
    	#ifdef CAN_ENABLE_UPDATE
    	    ConfigureCANDevice(fnRetValue == 2 ? canREG2 : canREG1);
    	#endif
    	#ifdef SPI_ENABLE_UPDATE
    	    ConfigureSPIDevice(SPI_PORT);
    	#endif
    	#ifdef UART_ENABLE_UPDATE
    	    ConfigureUartDevice();
    	#endif
    
    	//
    	// Branch to the update handler. Use can1
    	//
    	#ifdef CAN_ENABLE_UPDATE
    	    UpdaterCAN(fnRetValue == 2 ? canREG2 : canREG1);
    	#endif
    }

    I realized after sending the original question that since my application code does use CAN interrupts, I can pass the port used to initiate the software update into the magic number, instead of having the bootloader determine the CAN_PORT to use on the fly. There's no good reason to specify using canREG1 for the update when sending the "initiate update" message via canREG2.

    Hopefully this makes sense. I just wanted to make sure to avoid a situation where I specify a CAN port when starting an update (using the other bus for the message), and the specified bus is faulted, bricking that unit since it would be stuck waiting for a ping that may never come. I've actually done this during testing, fortunately when I can either swap CAN leads around or just reload the bootloader. I won't have that option in production.

    As usual, thanks for the quick response! Apologies for the confusion and my delayed reply.

         - Tom

  • In my defense, "node" is used throughout the CAN HAL code. I knew I picked it up from somewhere. 

    ¯\_(ツ)_/¯