# Programming of Microcontrollers and other peripherals [closed]

This is a question based on the theory which I am reading and related to one design which I am trying to understand section by section

We are having microcontrollers and some peripherals are connected to it.

Microcontroller: https://www.nxp.com/docs/en/data-sheet/MPC5606S.pdf

EEPROM (16Kb): https://www.onsemi.com/pub/Collateral/CAT24C01-D.PDF

The microcontroller is connected to the EEPROM and SPI Flash.

Please check if my understanding is correct :

The software code for the microcontroller needs to stored in a separate non-volatile memory. So, that's why we are storing the boot code in the EEPROM which is a non volatile memory. And we have TFT data which needs to be displayed present in the SPI flash.

Forgive me if my question is too basic.

1. Once we write the software code for the microcontroller in our PC, how do we load it into the microcontroller?
2. How is the TFT information (transferred to) stored in the SPI Flash initially?
3. Does microcontroller have any sort of bootcode initially?

How are these done using Hardware?

I just want to know how the software for these codes get inside the hardware (ICs) before the board starts to operate.

Thank you all.

• "The software code for the microcontroller needs to stored in a separate non-volatile memory" - not necessarily! It looks like that microcontroller has on-board Flash, which would be the normal place for storing its program. – pjc50 Feb 5 '19 at 15:50

You asked to "Please explain in simple terms." so I will do thus that and omit all the technical details.

Once we write the software code for the microcontroller in our PC, how do we load it into the microcontroller?

Most manufacturers have a special 'box' which can be connected to the microcontroller with a 'programming cable'. The box connects to you PC with USB. The cable connects to certain pins of the microcontroller. The price of the box varies a lot and can be as little as $15 or as high as$250. You can also use the box for debugging, stepping through the code, setting breakpoints etc.

How is the TFT information (transferred to) stored in the SPI Flash initially?

Most likely you have to write a program to upload the data into it. (Just like you have to write a program to get the data out of it).

There are two other possibilities:

1. Program the chip before placing it on the PCB.

2. Sometimes it can be programmed in-situ (on the board). But for that you may need a special circuit on the PCB to make sure you isolate it from the microcontroller which it is connected to. You will also need separate SPI programming hardware.

Does microcontroller have any sort of bootcode initially?

Some do, some don't. It depends on the type and the manufacturer.

Thank you very much for keeping this answer as simple as possible. Can you please tell the name of the interface which is used to load the software code in the microcontroller?

The interface differs per manufacturer.

Some use JTAG (ARM) or the JTAG pins with a non-JTAG protocol (ARM SWD) Others use the SPI interface (ATMEL).

However many have their own interface and have a proprietary protocol. Especially on chips with a very low pin count, (e.g. 6, 8, 14, or 16 pins) they use a one-wire debug interface.

Most often the protocol is unknown but some have been disclosed and other debug interfaces have been reverse engineered. The latter especially with the more popular chips.

Just as a side note: when you are new to working with micro-controllers it is worth every penny to buy a ready-made box. Even with that it is difficult enough to get the interface and the chip up and running.

• Thank you very much for keeping this answer as simple as possible. Can you please tell the name of the interface which is used to load the software code in the microcontroller? – Freshman Feb 5 '19 at 13:16

Searching for the chip at NXP.com, I found this reference manual

https://www.nxp.com/docs/en/reference-manual/MPC5606SRM.pdf

which discusses some tools

1.7.1 The MPC5606S document set

The MPC5606S document set comprises:

• This reference manual (provides information on the features of the logical blocks on the device and how they are integrated with each other)

• The MPC5606S Microcontroller Data Sheet (specifies the electrical characteristics of the device)

• The device product brief

The following reference documents (available online at www.freescale.com) are also available to support the CPU on this device:

• e200z0 Power Architecture Core Reference Manual

• Variable-Length Encoding (VLE) Programming Environments Manual The aforementioned documents describe all of the functional and electrical characteristics of the MPC5606S microcontroller. Depending on your task, you may need to refer to multiple documents to make design decisions. However, in general the use of the documents can be divided up as follows:

• Use the reference manual (this document) during software development and when allocating functions during system design.

• Use the data sheet when designing hardware and optimizing power consumption.

• Use the CPU reference documents when doing detailed software development in assembly language or debugging complex software interactions.

Searhing freescale.com (which brings you back to NXP.com) this IDE seems to be the one for this chip

https://www.nxp.com/support/developer-resources/software-development-tools/codewarrior-development-tools/codewarrior-legacy/codewarrior-development-suite-special:CW-SUITE-SPECIAL

Feature

CodeWarrior IDE

C compiler and C source-level debugger – code and data size restricted to 128KB

P&E Flash Programmer and Debugger