j1939 Bootloader
j1939 Bootloader
J1939 Bootloader
Created by the J1939 Experts
1) Bootloader
2) Midpoint tables
3) Application
When the CPU comes out of reset, the bootloader decides if there is valid application software. If there isn’t,
the flash loader is started and attempts to receive an application over the J1939 network. If there was a
valid application, the application is started. Additional, the application has the ability to start the bootloader.
This is typically done if the application receives a start command over the J1939 network.
The midpoint tables allow for abstraction between the application and the bootloader. The tables contain
the following information: start addresses for the application and bootloader, application checksum value,
application is present flag, and bootloader version number. These tables reside at a fix memory location in
flash and should not be moved. If tables are moved, future versions of application code may not be
backwards compatible with previous versions of bootloaders. Also, due to the S12X family 16-bit
architecture both tables must reside in non-banked memory.
Memory Layout
Category Start End
1.2 flashJ1939:
The PC bootloader application, named flashJ1939.exe, works with Simma Software VNA-Value low-cost
J1939 to USB adapter to send the new flash image across the J1939 network. flashJ1939 allows the user to
specify the J1939 address of the target ECU and the s-record or hex file to be used.
Simma Software, Inc. specializes in real-time embedded software for the automotive industry. Simma Software, Inc
Products and services include protocol stacks, bootloaders, device drivers, training, and Terre Haute, IN 47802
Fax: 208-445-2913
J1939, CAN, J1587, J1708, J2497, J1922, ISO 15765, CANopen, UDS, XCP, LIN.
www.simmasoftware.com
Page 02
1.3.2 The application checksum is currently generated via flashJ1939 when reading in the application
file. It is then sent across the network and stored into flash memory so application validation can
happen every power cycle.
Step 2:
The second message that is sent to the ECU will be either ‘start programming entire flash’ or ‘start
programming application flash.’ The PC should then wait for a ‘request for data’ from the ECU. If the PC has
not received the response, it may resend indefinitely, each time waiting for a ‘request for data.’
Step 3: (J1939)
Next, the PC should send one address packet followed by at most twelve data packets. The address packet
contains the number of following data bytes and also the starting address for the data. The sequence
number in the address packet should match the sequence number in the first data packet, and then
increment for each additional data packet. The sequence number ranges from 0 to 255, and overflows to 0.
After sending the address and data packets, the PC should wait for another ‘request for data.’ This process
continues until the PC has no more available data to supply the ECU. For the last transmission, it is
anticipated that the PC probably will not have a full set of twelve packets to send. The ECU will respond be
requesting data packets at the point where the PC halted transmission. If the requests are for unavailable
data, the PC should ignore them.
Step 4:
The PC should now transmit a ‘stop programming flash’ message with the set and sequence number of the
last available data packet. The PC waits for an ‘acknowledge’, and may resend until an ‘acknowledge’ is
received.
Step 5:
This step is optional. Once the entire programming session has been completed, the ECU should reset itself.
The PC waits for this to occur, then listens to the communications network for messages being sent out
from the ECU. If no messages are being broadcast from the ECU, the PC may request data from the ECU.
Once the PC has received messages from the ECU, it should display a ‘programming successful’ message to
the user.
Simma Software, Inc. specializes in real-time embedded software for the automotive industry. Simma Software, Inc
Products and services include protocol stacks, bootloaders, device drivers, training, and Terre Haute, IN 47802
Fax: 208-445-2913
J1939, CAN, J1587, J1708, J2497, J1922, ISO 15765, CANopen, UDS, XCP, LIN.
www.simmasoftware.com
Page 03
PPGN equals 5:
Data Packets:
PPGN equals 3:
Command Packets:
PPGN equals 4:
DLC: 3 bytes
DLC: 3 bytes
DLC: 3 bytes
DLC: 3 bytes
DLC: 7 bytes
DLC: 3 bytes
Parm*1+: Flash error code (refer to Motorola’s an2720.pdf or flash.h for error codes)
DLC: 3 bytes
Parm*1+: Flash error code (refer to Motorola’s an2720.pdf or flash.h for error codes)
DLC: 4 bytes
DLC: 3 or 7 bytes
Simma Software, Inc. specializes in real-time embedded software for the automotive industry. Simma Software, Inc
Products and services include protocol stacks, bootloaders, device drivers, training, and Terre Haute, IN 47802
Fax: 208-445-2913
J1939, CAN, J1587, J1708, J2497, J1922, ISO 15765, CANopen, UDS, XCP, LIN.
www.simmasoftware.com