LIN bootloader MC9S12ZVL32

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LIN bootloader MC9S12ZVL32

Jump to solution
3,726 Views
melanieloy
Contributor I

Dear Community members,

 

yesterday I read through AN 4723 and also got a first quick look at the example code for ZVM and ZVH source code.

First thing I want to know now is if the procedure described in the AN 4723 is also valid for ZVL devices ? If yes is it possible to adapt the example code for LIN for an ZVL device ?

Is there further documentation or example code available especially for the ZVL devices ?

 

Thanks for all your answers in advance.

 

Have a nice day.

 

BR,

Melanie

Labels (1)
0 Kudos
1 Solution
1,718 Views
RadekS
NXP Employee
NXP Employee

Hi Melanie,

Thank you for more details.

Yes, you will have to initialize LIN PHY and adapt comms.c for pack/unpack of LIN protocol.

The LIN PHY is routed into SCI0 by default. So, you will probably not need to modify MODDRO register in bootloader.

Yes, the flow looks more-less correct with some exceptions/notes:

About 3) LIN stack: http://www.nxp.com/files/microcontrollers/software/device_drivers/FSL_LIN_2.X_STACK.zip

Very simple LIN (according LIN spec v1.3) implementation could be find in my older S12G examples:

https://community.nxp.com/docs/DOC-93792

About 5) The AN4723 bootloader code is very simple code which is rather base for inspiration than production software. All macros are defined in main.h file. However the AN4723 bootloader code contains many hard coded values which might be written as macros…

About 7) I would like to recommend first tests of bootloader in debug mode

About 8) You will probably need some PC application/HW tool for sending MCU’s application trough LIN.

About 9) The current AN4723 bootloader code implementation always starts bootloader first and application is started after timeout (without serial communication).

Note: The AN4723 bootloader code uses external oscillator. If your board do not contain external oscillator or when oscillator frequency is not one of predefined (macro OSCILLATOR_FREQUENCY), you have to update also code for PLL (CPMU.c). See https://community.nxp.com/docs/DOC-330238 for more details about clock settings.

I hope it help you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

3 Replies
1,718 Views
RadekS
NXP Employee
NXP Employee

Hi Melanie,

Yes, the AN4723 code may be used also for S12ZVL family.

Currently I am not aware about any AN4723 bootloader example project especially for S12ZVL, however the modifications should not be difficult.

I would like to recommend create new project for your S12ZVL device and use code files from Source\Bootloader, the file Comms.h from Source\Comms and the Comms.c from Source\Comms\SCIV6.

Note: SCIV5 was used only for early S12ZVM prototypes. The difference between SCIV5 and SCIV6 is mainly in baudrate calculation.

Additionally you should edit original prm file according Bootloader example projects. Be aware that S12ZVL32 has smaller RAM (0x001000 TO 0x0013FF) and Flash (0xFF8000 TO 0xFFFFFF) than S12ZVM128 (0x001000 TO 0x002FFF) & (0xFE0000 TO 0xFFFFFF). Also EEPROM is smaller (0x100000 TO 0x10007F). So, you could not simply copy&paste linker file.

You should also edit main.h file with most important definitions like FLASH_START_ADD (0xFF8000), FLASH_SECTORS_TO_ERASE (60 for ZVL32), GPIO macros (according your board), APPLICATION_START_ADD (0xFF8000 or other according your application),…

Note: the Comms code was created for SCI1 module. By default SCI1 pins are routed to PT0, PT1 pins. You may modify MODRR0 register to route these signals to PT4,PT5 pins, but I cannot recommend it. The MODRR0 register could be modified just once in normal mode and AN7423 Bootloader starts application code without reset. So, we have to avoid to write into any write once register in bootloader code.

The different approach for switch between bootloader and application may be based on MCU reset and tiny dispatcher code at early start of MCU like in AN4258 Serial Bootloader for S12(X) Microcontrollers Based on 180 nm Technology.

I hope it help you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,718 Views
melanieloy
Contributor I

Hi Radek,

thanks for your already very helpful reply. Makes things again clearer to me.

I have to use LIN boot loader for sure. I only have those pins outside a housing. So this means if I understood you right that I have to adapt comms.c for usage of LIN and I have to make sure with an reset to be able to write to MODDRO register again. Correct ?

So my flow would be like that

1.create new project for MC9S12VZLS32

2. copy all the files from boot loader and the files from SCIV6 into this project

3. modify comms.c for LIN usage

4. modify the linker file (add SHADOW_RAM_S and SHADOW_ROM_S like shown in 5.2 but with adapted addresses depending on the size of the comms interface)

5. modify main.h

    Question for you are there more macros than the ones described in the application note 4723 ? Where can I look them up in  my source files ?

6. Flash code onto microcontroller

7. Make an POR

8. Send s19 file of the code that should be executed line by line via LIN into the microcontroller

9. After entering the main application make a reset

10. start main application with first step setup of the microcontroller.

Is this flow correct or do I have an error in that sequence some where ?

I just want to make sure that I really got it right before starting to code.

I'll also read through the other application note you mentioned of course.

Thanks a lot for your help.

Have a nice evening.

BR,

Melanie

1,719 Views
RadekS
NXP Employee
NXP Employee

Hi Melanie,

Thank you for more details.

Yes, you will have to initialize LIN PHY and adapt comms.c for pack/unpack of LIN protocol.

The LIN PHY is routed into SCI0 by default. So, you will probably not need to modify MODDRO register in bootloader.

Yes, the flow looks more-less correct with some exceptions/notes:

About 3) LIN stack: http://www.nxp.com/files/microcontrollers/software/device_drivers/FSL_LIN_2.X_STACK.zip

Very simple LIN (according LIN spec v1.3) implementation could be find in my older S12G examples:

https://community.nxp.com/docs/DOC-93792

About 5) The AN4723 bootloader code is very simple code which is rather base for inspiration than production software. All macros are defined in main.h file. However the AN4723 bootloader code contains many hard coded values which might be written as macros…

About 7) I would like to recommend first tests of bootloader in debug mode

About 8) You will probably need some PC application/HW tool for sending MCU’s application trough LIN.

About 9) The current AN4723 bootloader code implementation always starts bootloader first and application is started after timeout (without serial communication).

Note: The AN4723 bootloader code uses external oscillator. If your board do not contain external oscillator or when oscillator frequency is not one of predefined (macro OSCILLATOR_FREQUENCY), you have to update also code for PLL (CPMU.c). See https://community.nxp.com/docs/DOC-330238 for more details about clock settings.

I hope it help you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------