Install and Use Bare Board Support Package on Phytec phyCORE-MPC5676R


Table of Contents

1. License
2. Description of BSP
2.1. Files created by Jan Kobler
2.2. Files created by CodeWarrior Project Manager
3. Install Tools
3.1. Console Application
3.2. Git Version control
3.2.1. Attach ConEmu to Git Bash
4. Download the source code of the BSP
5. Install the source code of the BSP
6. Development with CodeWarrior MCU 10.6
6.1. Install CodeWarrior MCU 10.6
6.2. Import and Build BSP
6.3. Debug
6.4. Log
6.4.1. Log Serial Port
7. Module Structure of the Source Code
7.1. Main
7.2. Command Input and Menue Output
7.3. Configuration
7.4. CPU State
7.5. Uart Output and Input on eSCIA or eSCIB
7.6. DSPI
7.6.1. AT25256B
7.6.2. N25Q128A
7.6.3. M41T93RMY6F
7.7. LAN
7.8. LED
7.9. Switch S1
7.10. External Flash
7.11. CPU Startup Code
7.12. CPU Header
7.13. Timer
7.14. Formatted Text Output
7.15. Documents
7.16. Misc
7.17. Standard Libraries
7.18. Interrupt Handler

1. License

Author: Jan Kobler, Kobler Systems GmbH, email: eng1@koblersystems.de

This work (only this document) by Kobler Systems GmbH is licensed under the MIT License. To view a copy of this license, visit http://opensource.org/licenses/MIT.

The license of the software is mentioned further below, in the corresponding source code files or in other accompanying files.

2. Description of BSP

This is a BSP for the board Phytec phyCORE-MPC5676R for the development environment CodeWarrior for Microcontrollers v10.6.

It is based on a CodeWarrior Project for the CPU MPC5676R which has the following features:

  • There are two build targets: RAM, FLASH

  • RAM target runs in internal SRAM.

  • Download the binary image of the RAM build target through the JTAG port to the hardware target.

  • FLASH target runs in internal flash and uses internal SRAM.

  • The binary image of the FLASH build target can be written through JTAG port into the internal flash on the hardware target.

  • FLASH target can boot the board standalone.

  • Second core of the CPU MPC5676R is also started.

  • Only the BookE instruction set is used.

Here PE Micro Nexus Multilink has been used for connecting to the JTAG port of the board.

The CodeWarrior project has been enhanced by following features, which are specific to the Phytec phyCORE-MPC5676R board:

  • Configuration of the chip selects of external SRAM, external flash, FPGA and LAN device.

  • FMPLL is set to 180MHz

  • Cache is enabled.

  • Configuration and usage of both serial ports.

  • Configuration and usage of the time base register in order to compute timeouts.

  • Configuration and usage of the LEDs D1 to D4.

  • Configuration and usage of the SPI RTC M41T93RMY6F.

  • Configuration and usage of the SPI Flash AT25256B.

  • Configuration and usage of the SPI Flash N25Q128A. DMA Access.

  • Configuration and usage of the Ethernet controler LAN9221i. Simple ping test is working.

  • Usage of the external flash. Read IDs, erase sectors, write dummy data.

  • Configuration and usage of the switch S1. LED is switched on, when S1 is pressed.

  • Almost all code is executed on CPU core 0.

  • LED D3 is toggled by CPU core 1.

Following commands can be executed:

help                              56    Show available commands
cpu_info                           1    Info CPU
clock_info                         6    Info Clock
cache_info                         7    Info L1 Cache
mmu_info                           8    Info MMU
ebi_info                           9    Info EBI
siu_pcr_info                      84    Info SIU pin configurations
iflash_info                       93    Info internal flash
led_test_2                         3    Toggle LED D1..D4 10 times
switch_test                        5    Test Switch S1
esci_b_loop                       85    eSCI B Loop Test, Port P2B, top UART port
eflash_id_test                    12    Test external Flash: Read Device Id
eflash_cfi_test                   46    Test external Flash: CFI Query
eflash_erase                      47    Test external Flash: erase sectors
eflash_write_1                    48    Test external Flash: program
dspi_at25_wp_1_test               17    Test SPI bus U6 AT25256B, /WP=1
dspi_at25_wp_0_test               18    Test SPI bus U6 AT25256B, /WP=0, write protection 
dspi_at25_write_test              90    Test SPI bus U6 AT25256B, write, read, compare
dspi_at25_read_test               91    Test SPI bus U6 AT25256B, read, 
dspi_n25_4_test                   21    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s
dspi_n25_6_write                  89    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s, write,read, compare
dspi_n25_5_read                   92    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s, read
dspi_m41_edma_test                22    Test SPI bus U7 M41T93RMY6F EDMA TX, RX
dspi_m41_date_set                 23    date_01: Set date and time on U7 M41T93RMY6F, use global variable date_01
date_var_show                     25    date_01: Show date and time of global variable date_01
date_var_set_date                 26    date_01: Set date in global variable date_01
date_var_set_time                 27    date_01: Set time in global variable date_01
lan_mem_show                      31    read lan registers, just show memory range
lan_ping                          32    Test LAN ping
lan_reg_show                      58    Show LAN registers setting
lan_init                          59    Force LAN device initialisation

2.1. Files created by Jan Kobler

The following files have been created and written by Jan Kobler, Kobler System GmbH and are distributed under the MIT License. The MIT License can be found at the head of these files or at http://opensource.org/licenses/MIT.

Readme.html
Readme.xml
doc/board/5676R_phyCORE/ksp-0180-test-02-cw/Readme_5676R_phyCORE_ksp-0180-test-02-cw.html
doc/board/5676R_phyCORE/ksp-0180-test-02-cw/Readme_5676R_phyCORE_ksp-0180-test-02-cw.xml
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_dspi.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_esci.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_lan.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_led.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_switch.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cmd_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cmd_02_main.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cpu_init_cache.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cpu_init_info.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cpu_init_timer.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/DataDef.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/date_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_ethframe.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_mac_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_phy_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_sys_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_n25q128a_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_n25q128a.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_m41t93_clock.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_m41t93.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_cpu.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_dspi.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_ebi.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_edma.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_emios.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_esci.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_flash.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_flash_shadow.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_fmpll.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_intc.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_siu_b.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_siu.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_swt.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/StringBuffer_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/StringBuffer_03.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/stringify_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_02_m41t93.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_03_at25256b.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_04_n25q128a.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_edma_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_ext_flash_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_lan_01_init.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_lan_02_info.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_lan_04_ip.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_led_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_prefix.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_switch_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_uart_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/timeout_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_dspi.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_esci.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_lan.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_led.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_switch.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_init_fmpll.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_02_main.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_03_init.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/k_mpc5676r_cpu.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/ksp-0180-test-02-cw.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/Memory_Layout.txt
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/mpc5676r_init_cache.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/mpc5676r_init_info.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/mpc5676r_init_timer.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/Readme_Version.txt
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/StringBuffer_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/StringBuffer_03.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_02_m41t93.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_03_at25256b.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_04_n25q128a.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_edma_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_ext_flash_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_lan_01_init.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_lan_02_info.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_lan_04_ip.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_led_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_switch_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_uart_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/timeout_01.c

2.2. Files created by CodeWarrior Project Manager

The following files have been created by the CodeWarrior Project Manager. Please read the license of CodeWarrior. Some files have been changed by Jan Kobler, Kobler System GmbH in order to support the board Phytec phyCORE-MPC5676R.

src/board/5676R_phyCORE/ksp-0180-test-02-cw/.cproject
src/board/5676R_phyCORE/ksp-0180-test-02-cw/.project
src/board/5676R_phyCORE/ksp-0180-test-02-cw/.settings/com.freescale.core.ide.cdt.toolchain.prefs
src/board/5676R_phyCORE/ksp-0180-test-02-cw/.settings/com.freescale.core.ide.newprojectwizard.prefs
src/board/5676R_phyCORE/ksp-0180-test-02-cw/MPC5676R_readme.txt
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC0_Sources/Exceptions.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC0_Sources/IntcInterrupts_p0.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC0_Sources/ivor_branch_table_p0.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC1_Sources/Exceptions_p1.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC1_Sources/IntcInterrupts_p1.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC1_Sources/ivor_branch_table_p1.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC1_Sources/main_p1.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/PRC1_Sources/__start_p1.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Prefix/MPC5676R_RAM_BOOKE_MC.prefix
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Prefix/MPC5676R_FLASH_BOOKE_MC.prefix
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/Exceptions.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/Exceptions_p1.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/IntcInterrupts.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/IntcInterrupts_p1.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/MPC5676R.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/MPC5676R_HWInit.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/typedefs.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Debugger/ksp-0180-test-02-cw_RAM_PnE USB-ML-PPCNEXUS.launch
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Debugger/ksp-0180-test-02-cw_FLASH_PnE USB-ML-PPCNEXUS.launch
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Debugger/MPC5676R_RAM_BOOKE.tcl
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Debugger/MPC5676R_FLASH_BOOKE.tcl
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Debugger/MPC5676R.mem
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Linker_Files/MPC5676R_FLASH.lcf
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Linker_Files/MPC5676R_RAM.lcf
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Startup_Code/MPC5676R_HWInit.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Startup_Code/MPC5676R_init_flash.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Startup_Code/MPC5676R_init_ram.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Startup_Code/MPC5676R_Startup.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Settings/Startup_Code/__ppc_eabi_init.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/main.c

You must find and read the latest CodeWarrior license files yourself.

My current understanding, which is solely for your info, is:

  • These files are covered by the Freescale Software License Agreement Freescale_Software_EULA.pdf. This license agreement is part of CodeWarrior MCU 10.6 and can be found in the folder MCU/License in your installation folder of CodeWarrior.

  • Because of the Limited Distribution Rights these files may NOT be distributed in SOURCE form!

3. Install Tools

3.1. Console Application

Because sometimes you have to enter commands on the command line, you will need a user friendly console application. I suggest to install: ConEmu. Usally this installer should be the right one: Download ConEmu Stable, Installer ( 32-bit, 64-bit). You can find it on the ConEmu download page.

3.2. Git Version control

Install Git from the Git downloads page. It will be installed into /C/Program Files (x86)/Git. Open the Git Bash application and enter following commands:

uname -s

The expected output is: Output:

MINGW32_NT-6.1

You can list the available commands:

ls -l /bin

You can show the environment macros:

env

Show the home folder of the current user:

echo ${HOME}
ls -l ${HOME}

The Git tools create an enviroment which is similar to a Linux enviroment. You can use the commands in the same way as on Linux, when they are available.

3.2.1. Attach ConEmu to Git Bash

After opening Git Bash you can start ConEmu and attach it to the Git Bash console window. In ConEmu select menue item 'Attach to .. '. In the dialog window select the console application MINGW32 and press attach. Now the content of the console window of Git Bash should appear in the window of ConEmu and you should be able to use it.

4. Download the source code of the BSP

Download the archive ksp-0180-test-02-cw-src-2017-01-12-4.zip into the folder ${HOME}/Downloads. The archive ksp-0180-test-02-cw-src-2017-01-12-4.zip is downloaded for your information. It contains the latest version of the source code.

Download the git bundle ksp-0180-test-02-cw-src-2017-01-12-4.git-bundle into the folder ${HOME}/Downloads.The git bundle contains the current version of the git repository and will be used to install the source code of the BSP on your computer.

5. Install the source code of the BSP

Clone the git bundle ksp-0180-test-02-cw-src-2017-01-12-4.git-bundle into the folder ${HOME}/Documents/KSP-0180/ksp-0180-test-02-cw-src-git.

mkdir -p ${HOME}/Documents/KSP-0180
git clone ${HOME}/Downloads/ksp-0180-test-02-cw-src-2017-01-12-4.git-bundle -b ksp-0180-cw-04 ${HOME}/Documents/KSP-0180/ksp-0180-test-02-cw-src-git

The folder contains now the source code of the BSP

ls -l ${HOME}/Documents/KSP-0180/ksp-0180-test-02-cw-src-git

The same source code is also in the archive ksp-0180-test-02-cw-src-2017-01-12-4.zip

6. Development with CodeWarrior MCU 10.6

The BSP has been developed and tested with CodeWarrior MCU 10.6

6.1. Install CodeWarrior MCU 10.6

You can find a description of CodeWarrior MCU 10.6 on the page http://www.nxp.com/products/software-and-tools/software-development-tools/codewarrior-development-tools/codewarrior-development-studios/codewarrior-for-microcontrollers/codewarrior-for-mcus-eclipse-ide-coldfire-56800-e-dsc-kinetis-freescale-56xx-rs08-s08-s12z-v10.6:CW-MCU10. Download the Evaluation edition by selecting the Download Eval button. You have to register at NXP before you can download it. After downloading the image you can install the software.

All the tests with this software have been done, without generating or registering a license key. The size limit seems to be at 512k Byte.

6.2. Import and Build BSP

Open CodeWarrior MCU 10.6

  • Select Menue: File -> Import

  • Select Item: General -> Existing Projects into Workspace

  • Select the root directory: ${HOME}/Documents/KSP-0180/ksp-0180-test-02-cw-src-git

  • A list of projects appears. Select the project ksp-0180-test-02-cw

Now you should be able to build both configurations RAM and FLASH of the project ksp-0180-test-02-cw

6.3. Debug

Debugging has been tested with the P&E USB MultiLink PPCNEXUS device.

Configuration of the board Phytec phyCORE-MPC5676R.

  • Set the DIP switch BOOTCFG1 on the board to 1-ON, 2-ON. This selects booting from internal flash.

  • Connect a serial cable to the lower serial port P2. Serial port will be configured to 115200 8N1.

  • Set the jumpers of the LEDs D1..D4.

6.4. Log

6.4.1. Log Serial Port

Output at lower serial port P2 at speed 115200 8N1

Start of the application:

Hello world from Phytec phyCORE-MPC5676R Aug 22 2016 13:34:45                                                                      
                                                                                                                                   
( Enter 'help' for list of commands!!                                                                                              
Enter Tab (TAB, CTRL-I) for valid commands!!                                                                                       
Enter 0 to exit menue!!                                                                                                            
Press Backspace (CTRL-H) to ignore input and restart dialog                                                                        
Enter command and press Return
ksp-0180-test-02-cw cmd> 

7. Module Structure of the Source Code

7.1. Main

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/ksp-0180-test-02-cw.c

Welcome message:

Hello world from Phytec phyCORE-MPC5676R Aug 19 2016 09:40:41

*******************************************
*  Project:ksp-0180-test-02-cw
*
*  Version: 
*
*******************************************


( Enter 'help' for list of commands!!
Enter Tab (TAB, CTRL-I) for valid commands!!
Enter 0 to exit menue!!
Press Backspace (CTRL-H) to ignore input and restart dialog
Enter command and press Return )
ksp-0180-test-02-cw cmd> 

7.2. Command Input and Menue Output

All commands are defined in the file src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_03_init.c

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cmd_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_02_main.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cmd_02_main.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/cmd_03_init.c

Available commands in this module:

help                              56    Show available commands

List of available commands in all modules:

ksp-0180-test-02-cw cmd> 
help
ID = 56 has been selected

**************************

Name help ID = 56 Desc: 'Show available commands' will be called now.

**************************

help                              56    Show available commands
cpu_info                           1    Info CPU
clock_info                         6    Info Clock
cache_info                         7    Info L1 Cache
mmu_info                           8    Info MMU
ebi_info                           9    Info EBI
siu_pcr_info                      84    Info SIU pin configurations
iflash_info                       93    Info internal flash
led_test_2                         3    Toggle LED D1..D4 10 times
switch_test                        5    Test Switch S1
esci_b_loop                       85    eSCI B Loop Test, Port P2B, top UART port
eflash_id_test                    12    Test external Flash: Read Device Id
eflash_cfi_test                   46    Test external Flash: CFI Query
eflash_erase                      47    Test external Flash: erase sectors
eflash_write_1                    48    Test external Flash: program
dspi_at25_wp_1_test               17    Test SPI bus U6 AT25256B, /WP=1
dspi_at25_wp_0_test               18    Test SPI bus U6 AT25256B, /WP=0, write protection 
dspi_at25_write_test              90    Test SPI bus U6 AT25256B, write, read, compare
dspi_at25_read_test               91    Test SPI bus U6 AT25256B, read, 
dspi_n25_4_test                   21    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s
dspi_n25_6_write                  89    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s, write,read, compare
dspi_n25_5_read                   92    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s, read
dspi_m41_edma_test                22    Test SPI bus U7 M41T93RMY6F EDMA TX, RX
dspi_m41_date_set                 23    date_01: Set date and time on U7 M41T93RMY6F, use global variable date_01
date_var_show                     25    date_01: Show date and time of global variable date_01
date_var_set_date                 26    date_01: Set date in global variable date_01
date_var_set_time                 27    date_01: Set time in global variable date_01
lan_mem_show                      31    read lan registers, just show memory range
lan_ping                          32    Test LAN ping
lan_reg_show                      58    Show LAN registers setting
lan_init                          59    Force LAN device initialisation

( Enter 'help' for list of commands!!
Enter Tab (TAB, CTRL-I) for valid commands!!
Enter 0 to exit menue!!
Press Backspace (CTRL-H) to ignore input and restart dialog
Enter command and press Return )
ksp-0180-test-02-cw cmd> 

7.3. Configuration

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_prefix.h

Macros for configuring the CPU

#define TARGET_PHY_MPC5676R_01 1
#define CPU_FREQ_CORE (180000000UL)  // core frequency f_sys in Hz
#define CPU_BAUDRATE_DIVISOR 49 // divisor for serial port 

A lot of macros for selecting which module should be used.

#define use_test_uart 1
#define use_test_init_uart 1
#define use_test_uart_b 1
#define use_test_led 1
#define use_test_switch 1
#define use_test_cpu 1
#define use_test_tlb 1
#define use_test_l1c 1
#define use_test_siu_pcr 1
#define use_test_iflash_info_1 1
#define use_test_external_flash 1
#define use_test_lan 1
#define use_test_lan_2 1
#define use_test_dspi 1
#define use_test_date 1
#define use_test_edma 1
#define use_test_clock 1
#define use_test_timebase_enable 1
#define use_test_timeout 1
#define use_test_cmd_01 1

7.4. CPU State

Output of current register settings of the CPU

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cpu_init_info.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/mpc5676r_init_info.c

Available commands in this module:

cpu_info                           1    Info CPU
clock_info                         6    Info Clock
cache_info                         7    Info L1 Cache
mmu_info                           8    Info MMU
ebi_info                           9    Info EBI
siu_pcr_info                      84    Info SIU pin configurations
iflash_info                       93    Info internal flash

7.5. Uart Output and Input on eSCIA or eSCIB

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_esci.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_esci.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_uart_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_uart_01.h

Available commands in this module:

esci_b_loop                       85    eSCI B Loop Test, Port P2B, top UART port

7.6. DSPI

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/date_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_dspi.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_dspi.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_01.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_edma_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_edma_01.h

7.6.1. AT25256B

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_03_at25256b.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_03_at25256b.c

Available commands in this module:

dspi_at25_wp_1_test               17    Test SPI bus U6 AT25256B, /WP=1
dspi_at25_wp_0_test               18    Test SPI bus U6 AT25256B, /WP=0, write protection 
dspi_at25_write_test              90    Test SPI bus U6 AT25256B, write, read, compare
dspi_at25_read_test               91    Test SPI bus U6 AT25256B, read, 

7.6.2. N25Q128A

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_n25q128a.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_n25q128a_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_04_n25q128a.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_04_n25q128a.c

Available commands in this module:

dspi_n25_4_test                   21    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s
dspi_n25_6_write                  89    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s, write,read, compare
dspi_n25_5_read                   92    Test SPI bus U14, U19 N25Q128A, EDMA TX, RX, struct dspi_01_s, read

7.6.3. M41T93RMY6F

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_m41t93.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_m41t93_clock.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_dspi_02_m41t93.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_dspi_02_m41t93.c

Available commands in this module:

dspi_m41_edma_test                22    Test SPI bus U7 M41T93RMY6F EDMA TX, RX
dspi_m41_date_set                 23    date_01: Set date and time on U7 M41T93RMY6F, use global variable date_01
date_var_show                     25    date_01: Show date and time of global variable date_01
date_var_set_date                 26    date_01: Set date in global variable date_01
date_var_set_time                 27    date_01: Set time in global variable date_01

7.7. LAN

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_ethframe.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_mac_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_phy_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_lan9221_sys_csr.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_lan.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_lan.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_lan_01_init.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_lan_01_init.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_lan_02_info.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_lan_02_info.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_lan_04_ip.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_lan_04_ip.h

Available commands in this module:

lan_mem_show                      31    read lan registers, just show memory range
lan_ping                          32    Test LAN ping
lan_reg_show                      58    Show LAN registers setting
lan_init                          59    Force LAN device initialisation

7.8. LED

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_led.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_led.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_led_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_led_01.h

Available commands in this module:

led_test_2                         3    Toggle LED D1..D4 10 times

7.9. Switch S1

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/board_dev_switch.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_dev_switch.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_switch_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_switch_01.h

Available commands in this module:

switch_test                        5    Test Switch S1

7.10. External Flash

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/test_ext_flash_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/test_ext_flash_01.h

Available commands in this module:

eflash_id_test                    12    Test external Flash: Read Device Id
eflash_cfi_test                   46    Test external Flash: CFI Query
eflash_erase                      47    Test external Flash: erase sectors
eflash_write_1                    48    Test external Flash: program

7.11. CPU Startup Code

Startup code added to the CodeWarrior MCU 10.6 Compiler

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/5676R_phyCORE_init_fmpll.S

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cpu_init_cache.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/cpu_init_timer.h

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/mpc5676r_init_cache.S
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/mpc5676r_init_timer.S

The already available startup code in CodeWarrior has been adjusted and is used.

7.12. CPU Header

Access of the memory mapped registers and the special purpose registers of the CPU.

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_dspi.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_ebi.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_edma.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_emios.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_esci.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_flash.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_flash_shadow.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_fmpll.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_intc.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_siu_b.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_siu.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_swt.h

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/k_mpc5676r_cpu.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/k_mpc5676r_cpu.S

7.13. Timer

Detecting timeouts or waiting specific times.

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/timeout_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/timeout_01.h

No timer interrupt is used.

7.14. Formatted Text Output

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/StringBuffer_03.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/StringBuffer_03.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/StringBuffer_01.c
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/StringBuffer_01.h

7.15. Documents

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/Memory_Layout.txt
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/Readme_Version.txt
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Sources/Readme.txt

7.16. Misc

Source Files:

src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/DataDef.h
src/board/5676R_phyCORE/ksp-0180-test-02-cw/Project_Headers/stringify_01.h

7.17. Standard Libraries

No standard C Library function calls are used, in order to make the source code small and independent of any C library.

7.18. Interrupt Handler

No interrupt handlers are used. No interrupts are enabled.