Brendan
NXP specifies using the FRDM-K22F
http://www.utasker.com/kinetis/FRDM-K22F.html
or the TWR-K22F120M
http://www.utasker.com/kinetis/TWR-K22F120M.html
for developments aimed at K22F128 100MHz parts.
Therefore it is best to select the FRDM_K22F target and then adjust its configuration to suit the final chip.
The open source uTasker version doesn't have full K22F128 100M support but it is very easy to adapt.
#define FRDM_K22F
1. Specify the speed to be 100MHz max.
#define KINETIS_MAX_SPEED 100000000
2. Since the chip has much less SRAM reduce the heap size, eg
#define OUR_HEAP_SIZE (HEAP_REQUIREMENTS)((12 * 1024) * MEM_FACTOR)
3. In app_hw_kinets. adjust the Flash and RAM sizes:
#define SIZE_OF_FLASH (128 * 1024) // 128k FLASH
#define SIZE_OF_RAM (24 * 1024) // 24k SRAM
4. It will be necessary to edit kinteits.h so that the SRAM addressing is correct by adding (at the appropriate location)
#elif defined KINETIS_K22 && defined KINETIS_K_FPU && (SIZE_OF_RAM == (24 * 1024))
#define RAM_START_ADDRESS (0x20000000 - (8 * 1024)) // SRAM L is 8k and is anchored to end at 0x1ffffffff
// SRAM H is the remainder of RAM size and is anchored to start at 0x20000000
5. You will need to use also a linker script file that matches.
For example use K_128_16.ld and modify two lines
SRAM (wx) : ORIGIN = 0x1fffe1f0, LENGTH = 0x00006000-0x1f0
__SRAM_segment_end__ = 0x20003fff;
to increase form 16k to 24k SRAM
The USB is compatible.
These are the (main) differences between the K22F512 120MHz and K22F128 100MHz
K22F128 has 2 SPIs, no USB-CD, no FTM3, no CMT, but has an I2S. There are only 4 DMA channels available.
All (available) interrupts are compatible so as long as non-existent channels are not attempted to be used all should be fine.
If you want to tune a little more exactly (shouldn't be really necessary) you can add/adjust these in kinetis.h
#elif defined KINETIS_K22
#if ((SIZE_OF_FLASH == (512 * 1024)) || (SIZE_OF_FLASH == (256 * 1024)) || (SIZE_OF_FLASH == (128 * 1024)))
#define UARTS_AVAILABLE 3
#else
#define UARTS_AVAILABLE 6
#endif
#elif defined KINETIS_K22
#if ((SIZE_OF_FLASH == (512 * 1024)) || (SIZE_OF_FLASH == (256 * 1024)) || (SIZE_OF_FLASH == (128 * 1024)))
#define LPUARTS_AVAILABLE 1
#define LPUARTS_PARALLEL // LPUARTs and UARTs are counted from 0
#elif defined KINETIS_K22 && (SIZE_OF_FLASH == (128 * 1024))
#define DMA_CHANNEL_COUNT 4
#elif defined KINETIS_K22 && (SIZE_OF_FLASH == (128 * 1024))
#define SPI_AVAILABLE 2
Any project that runs on the FRDM-K22F (K22F512 120M) should be able to run on a K22F128 100M by switching between 1, 2, 3 and 5 settings (1, 2 and 3 are usually controlled by a single define once a real target is set up).
Regards
Mark