Chris
1. Meaning of ports:
^ the pin is an input and has a '1' applied to it (if you click on the port you can toggle the input state - this can be read by code and generates interrupts if the port is configured for the edge). If you click on the buttons on the board you will see that they are in fact hooked up to inputs so that the buttons could be reacted to.
v - the pin is an input and pulled down (the default state after a reset can be configured for each pin to match pull-ups/downs in a particular design (default is all pulled-up).
P - configured as peripheral (many pins in the Kinetis default to a peripheral function) - the one selected is displayed by hovering the mouse over the port pin.
1 or 0 - configured as GPIO output, showing the logical drive state. Note that one output is toggling and connected to an LED on the board which is then toggling too.
2. The *.sim files are scripts that can control various simulation sequences. Eg. PTC-2 input can be driven high for 50ms after 200ms, then driven low, etc. This allows testing port input sequences (when more simple manual control is not suitable). Also UART receptions can be injected, or USB frames on certain endpoints etc., This applies to various communication interface (like Ethernet, SPI) as well as anogue input values.
The .sim files don't have anything to do with the port configurations or directly testing them.
3. The port configurations are performed in real Kinetis code and then tested in the environment. Here is a list of most configuration and control macros (in form of examples). They have the advantage that they include hooks to the simulator to allow it to check that the code has set things up correctly, as well as controlling ports as the code operates. They generate complete configuration code (including powering up ports) and are very code-efficient (in comparison to calling configuration library routines). Multiple port pins on a port can be configured at the same time as long as they use the same characteristics
_CONFIG_PORT_OUTPUT(A, PORTA_BIT24, (PORT_SRE_SLOW));
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(B, SPI2_CS0, SPI2_CS0, (PORT_SRE_FAST | PORT_DSE_HIGH));
_WRITE_PORT(E, 0x12345678);
_WRITE_PORT_MASK(C, (PORTC_BIT16 | PORTC_BIT18), LCD_BUS_MASK);
_TOGGLE_PORT(D, K60_LED_GREEN);
_CONFIG_PORT_INPUT(B, (PORTB_BIT24 |PORTB_BIT25) , (PORT_PS_UP_ENABLE));
_READ_PORT(E);
_READ_PORT_MASK(A, 0x0000ff00);
_CONFIG_PERIPHERAL(B, 1, (PB_1_I2C0_SDA | PORT_ODE | PORT_PS_UP_ENABLE));
_SETBITS(C, USB_HOST_POWER_ENABLE);
_CLEARBITS(C, USB_HOST_POWER_ENABLE);
4. There are two main possibilities for using this:
- if starting a new project, the complete environment can be used on all K and KL processors. It starts with a complete project (with USB and TCP/IP stacks, FAT, etc. and various drivers - depending on processor types capability) which are then enabled or disabled as required. The project runs completely in the simulator environments (displaying ports, communicating using scripts or with the real world by hooking up the Kinetis peripheral simulations to PC COM ports, the Ethernet NIC, or even CAN buses). The code is all C-code which can be built in the VisualStudio envoirnment where the embedded code can be tested and debugged in (approximale) real-time. When the work has been prepared the same code is cross-compiled and loaded to a real HW for final verification (or low level development of time critical stuff that can't be performed in the PC environment). Codewarrior, IAR, Keil, Rowley Crossworks, GCC or Atollic can be used since the project builds and operates with all.
- if you already have a developed project or need to use a different OS, stack etc. you can still use the port simulation by adding your configuration code (eg. in a single routine) and testing that it is OK. Once satisfied, copy the macros to the other project environment as well as the tested configuration and it should be fine for the HW like that. The final environmnet would be more constrained to developing and testing on the HW so will generally be less efficient overall.
5. This means that to use the project (either completely or just the port simulation) you need VisualStudio (the free express edition is adequate). You can get the complete project code from KINETIS Project Code .
Note that only the K20 and K21 pinouts are in the latest release but I added the K22 pinout for a quick test (but not the ADC pins). Adding new processor types is quite easy if needed.
I'll send you the file in case you would like to add it, but you can already test almost any Freecale board as it is.
Regards
Mark