Hi, I am using MCS9S12G128F0MLH controller. I would like to know whether this controller supports ISP or not. If supports then will it use UART interface to program the controller? I found from the reference manual like "external host communicates to controller via BKGD pin".
Could you please share how to program the controller using ISP (In Circuit programming). Or is it possible to program using UART from a processor. The processor has Linux OS.
Thanks in advance.
Hi Durgaprasad,
It seems that your question is the same as topic discussed below:
https://community.nxp.com/thread/433074
Please look at my answers there.
So, possible solutions are
1. bootloader inside S12G MCU and load application e.g via UART/SPI interface
2. program your processor with Linux OS as BDM interface.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Radek,
Thanks for the quick reply, and the info is very much helpful. I have a few questions, Could you please give some idea.
If I write one simple application (in processor) to send application firmware to the controller. Is Start12.c file necessary? Or main.c is sufficient?
After which point I can start sending application firmware to the controller?. I am supposed to send after BDM enabled, i.e., after BDM_Active_mode () function. Am I correct?
Is the application firmware Imaze for the controller should be in S-record format?
Could you please share any flow diagram which describes how to send FW to the controller from the processor. Which will really help me.
Once again thanks for the reply, please correct me if I am wrong.
Thanks in advance.
Hi Durgaprasad,
The Start12.c file contains code for initializing of MCU after reset – it is mainly initializing of the stack, load default values of variables from flash and clear zero variables. You may skip this code when you will manage that yourself in the main code.
The c files have to be compiled/linked to the machine code readable by S12 core. Typically we send to MCU file with S-record (contains only flash content, the typical file is with .sx or .s19 file extension). The abs file contains also additional debug information, however, this file is not in simple readable format (it is not a text file).
So, the flow is
1. Write your code in c/assembler
2. Make your project (compiler/linker/…)
3. Load s19/abs file content into MCU
a. by BDM interface
b. by UART or any other channel. The S12 MCU must be already preloaded by bootloader code. The bootloader code will receive application code and write it into flash.
Unfortunately, I haven’t any personal experience with any S12 toolchain for Linux.
Could you please share little bit more details about your project?
Do you really need load code into empty S12 MCUs by linux processor? Or S12 MCUs may be already preloaded by bootloader code from assembly site?
If you are able to load bootloader code by BDM interface, the main application might be later updated anytime trough UART. See AN4258 for more details.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Dear sir
Thanks for the quick reply, Let me explain the project details regarding the requirement.
If our case we are having a stack up board which is having micro controller MCS9S12G128 and it is mated to the main board which has the host processor .The interface between the host and the controller is SPI.(through stack up connector )
the BKGD pin and reset pin of the mc is connected to the host processor GPIO through Level translator since we have not exposed the BKGD pin in the stack up board through a connector we need to do it from the processor
Is it possible to load application firmware S19 image through the BKGD pin connected to the processor? ,
If it is possible .please share any doc or procedure ,
if it is not possible
Can i program the boot loader through any peripheral interface UART or SPI connected to the host processor ? (assuming no boot loader is present in mc )
Does the controller will be shipped with boot loader flashed internally ?
Hi Agxin,
Thank you very much for clarification of your application.
About you questions)
Yes, it is possible to load application firmware S19 image through the BKGD pin connected to the processor. However, it may also depend on your implementation of your processor pin and level translator. As I already wrote in the previous thread, the BKGD pin is bidirectional. So, the processor pin and level translator have to be able to configure to the digital output (generate log0 and log1) and the digital input state (with High Impedance).
The BDM communication is described in MCU reference manual – chapter 7 Background Debug Module (S12SBDMV1):
http://www.nxp.com/files/32bit/doc/ref_manual/MC9S12GRMV1.pdf
Optionally you may use AN4365 Qorivva MPC56xx Flash Programming Through Nexus/JTAG as general guidance how such programming works (with exception in different MCU core type and communication interface)
http://www.nxp.com/files/32bit/doc/app_note/AN4365.pdf
The Standard Software Driver for NVM (flash operations) you can download here:
http://www.nxp.com/files/microcontrollers/software/device_drivers/S12G_VR_NVM_SSD.exe
No, you cannot program the boot loader through any peripheral interface as UART or SPI connected to the host processor (assuming no boot loader is present in mc ).
Typically we deliver MCU with erased flash. For some bigger projects, you may order MCUs with already preprogrammed bootloader (or any other flash content) or use one of our partners (third party companies) for such task.
http://www.nxp.com/products/software-and-tools/mcu-programming:MCU_PROGRAMMING_CENTER
http://www.nxp.com/webapp/connect/memberDirSearch.sp#
Anyway, you may contact your sales representative or distributor with your question about such services.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Radek,
Thanks for clarifying doubts in detail. As you mentioned "Yes, it is possible to load application firmware S19 image through the BKGD pin connected to the processor". Could you please share any document or reference code to achieve this.
And one more question regarding BKGD pin. I would like to use BKGD pin after the application firmware started. Will it affect anything by using BKGD pin?
Thanks in advance.
Hi Durgaprasad,
Unfortunately I am not aware about any specific example code focused directly only on code loading.
As I already mentioned, the OSBDM or USBDM debuggers might be taken as inspiration.
I attached there also simple example code just for demonstrating of BDM communication (just load CPU registers).
https://community.nxp.com/thread/433074
As example of flash command routine you may look at PEmicro unsecure script automatically generated by CW – it will complete erase whole MCU flash and program security byte (at address 0xFF0F) to default value 0xFE (it program by phrase = 8 bytes).
For example:
WB 0x10A 0xFF means Write Byte 0xFF at address 0x10A (FCCOBHI register).
I am afraid that using processor pin connected to BKGD pin as GPIO will not work correctly. The BDM communication is possible even when MCU is in normal mode. So signal which are not relevant to S12G MCU may confuse this MCU and the MCU responses may interfere with processors levels.
Is it possible to disable/inhibit the voltage level translator for isolating processor and MCU signals?
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Radek,
Thanks for the info. I have a couple of questions, Could you please clarify.
Thanks in advance, Please correct me if I am wrong.
Hi Durgaprasad,
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------