ui processor rtos - hampussandberg/HexConnect GitHub Wiki
SPI Flash Memory Map
The SPI Flash (S25FL116K0XMFI011) has this memory organization:
- 32 blocks with 64 kbytes in each
- 512 sectors with 4 kbytes in each
- 8192 pages with 256 bytes in each
This means 1 block = 16 sectors = 256 pages
The splash image is stored in the SPI Flash. This is 800*480*3 = 1152000 bytes
. This will take up 1152000/1024/64 = 17,578125 ≈ 18 blocks
, which is a big portion of the SPI Flash. A bigger memory can be installed if more data should be stored on it.
A memory map of the SPI Flash can be seen below.
Block | Sector | Page | Startaddress (Hex) | Content |
---|---|---|---|---|
0 | 0 | 0 | 0x00000000 | reserved |
- | - | - | - | - 14 | 224 | 3584 | 0x000E0000 | Splash image start
- | - | - | - | - 31 | 511 | 8192 | 0x00200000 | Last page on SPI Flash
I2C EEPROM Memory Map
The I2C EEPROM is a 24LC256T with 256kbit = 32kByte capacity. It is divided into 512 pages with 64-byte in each.
A memory map of the I2C EEPROM can be seen below.
Page | Startaddress (Hex) | Content |
---|---|---|
0 | 0x0000 | reserved |
- | - | - 1 | 0x0040-0x0045 | Channel Id 1-6 1 | 0x0046-0x004B | Channel Type 1-6 1 | 0x004C | Buzzer Setting
- | - | - 511 | 0x7FC0 | Last page on I2C EEPROM
HAL_TICK and FreeRTOS
In the new HAL library there is a tick that has to be updated every ms but FreeRTOS "takes over" the SysTick. Therefore we have to add some code in port.c in the function void xPortSysTickHandler( void ). It should look something like this:
void xPortSysTickHandler( void )
{
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
executes all interrupts must be unmasked. There is therefore no need to
save and then restore the interrupt mask value as its value is already
known. */
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
{
/* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
/* The HAL need to update it's tick as well */
HAL_IncTick();
}