489
|
1 # OSTC4 Resources #
|
|
2
|
|
3 ## Hardware ##
|
|
4
|
|
5 There are two processors in the OSTC4:
|
|
6
|
|
7 * an [STM32F427IIT6](http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series/stm32f427-437/stm32f427ii.html) as main processor. It is a Cortex-M4 processor with FPU, running at 180 MHz.
|
|
8 It crunches most of the decompression code, the graphic display operations and the user interface.
|
|
9
|
|
10 * an [STM32F411RET6](http://www.st.com/en/microcontrollers/stm32f411re.html) as the RTE (Real-Time-Environment) processor.
|
|
11 This is another processor of the ARM Cortex M4 family, but with extremely low power modes and plenty of communication ports.
|
|
12 It runs real-time gas exchange simulation during dive, and interface to most peripherals.
|
|
13
|
|
14 Various peripherals are connected to them:
|
|
15
|
|
16 - A 800x480 pixels _LCD_ screen, with a live stream of color pixels send by an auto-refresh SDRAM.
|
|
17 - A pressure sensor.
|
|
18 - A magnetic compass.
|
|
19 - An ambient light sensor.
|
|
20 - Three buttons.
|
|
21 - A battery, and a battery gauge.
|
|
22
|
|
23 _OSTC4_ programming is based on the _HAL_ (for _Hardware Abstraction Layer_) provided by _ST_.
|
|
24 This allows to have a more readable C code, and to evolve more easily to another processors of the same familly.
|
|
25
|
|
26 ## Drivers Used by the Main CPU - aka CPU1-Discovery ##
|
|
27
|
|
28 The main _ARM-Cortex 4_ CPU uses the following resources provided by the
|
|
29 _HAL_ (_Hardware Abstraction Layer_)
|
|
30 provided by the processors makers _ST_ to ease code developement, security and portability:
|
|
31
|
|
32 - **HAL_DMA** _Direct Memory Accelerator_: automated memory transfers, used to manage SPI reception and transmission channels.
|
|
33 - **HAL_DMA2D** : a _specialized DMA dedicated to images manipulation_, used by `gfx_engine`to clear screens.
|
|
34 - **HAL_FMC** _Flexible Memory Controller_ to drice the external SDRAM used for display.
|
|
35 - **HAL_GPIO** _General Purpose Input/Output_: this is the programmable pins of the chip, used to connect nearly evrything.
|
|
36 - **HAL_LTDC** _LCD TFT Display Controller_: to transfer images to the screen memory ?
|
|
37 - **HAL_NVIC** _Nested Vector Interrupt Controller_: CORTEX IRQs used in `base.c` to handle buttons interrupts, in `gfx_engine.c` to manage VSYNC (screen's vertical sync) and in `stm32f4xx_hal_msp_hw2.c` to manage all other interrupts (ticks, DMA, DMA2D, TIM and USART).
|
|
38 - **HAL_RCC** _Reset and Clock Control_: used in `base.c` to setup system, PLL and screen clocks.
|
|
39 - **HAL_SDRAM** RAM controller used in `stm32f4xx_hal_msp_hw2.c` and in `base.c` to interface the external memory used by the screen.
|
|
40 - **HAL_SPI** _Serial Peripheral Interface_: implement the [standard SPI protocol](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus). Used to do full duplex communication between the two CPU in `data_exchange_main.c` to exchange dive settings and state, and in `externCPU2bootloader.c` to send firmware to _CPU2-RTE_.
|
|
41 - **HAL_TIM** basic _Timers_ used in `base.c` and PWM (_Pulse Width Modulation_) used to control backlight intensity.
|
|
42 - **HAL_UART** _Universal Asynchronous Receiver Transmitter_: serial communications used in `bonnexConnect.c`, `ostc.c`, `stm32f4xx_hal_msp_hw2.c`, `tCCR.c`, `tCpmm.c` and `tDebug.c`
|
|
43
|
|
44 ## Drivers Used by the Secondary CPU - aka CPU2-RTE ##
|
|
45
|
|
46 - **HAL_ADC** _Analog to Digital Converter_ channel 1 is used in `adc.c` for the ambient light sensor.
|
|
47 - **HAL_DMA** _Direct Memory Accelerator_: automated memory transfers, used to manage SPI reception and transmission channels when communicating to main CPU.
|
|
48 - **HAL_FLASH** allow erasing, programming, and managing read/write protection mechanisms of the internal FLASH memory.
|
|
49 - **HAL_GPIO** _General Purpose Input/Output_: this is the programmable pins of the chip, used to connect nearly evrything.
|
|
50 - **HAL_I2C** _Inter-Integrated Circuit_ [bus controller](https://en.wikipedia.org/wiki/I2C) is another standard bus, used to connect the pressure sensor in `pressure.c`, the magnetic compass in `compass.c` and the battery state in `batteryGauge.c`. Initialisations are in `baseCPU2.c` and `stm32f4xx_hal_msp_v3.c`.
|
|
51 - **HAL_NVIC** _Nested Vector Interrupt Controller_: CORTEX IRQs used in `baseCPU2.c` to handle clock ticks, buttons and wireless state. In `spi.c` to know end of SPI transmissions. And in `stm32f4xx_hal_msp_v3.c` to setup various _I2C_ interupts.
|
|
52 - **HAL_PWR** _Power Controller_: to manage sleep mode, low power and wakeup. And in `rtc.c` to manage FLASH power down.
|
|
53 - **HAL_RCC** _Reset and Clock Control_: used in `baseCPU2.c` to setup system, PLL clocks for ...
|
|
54 - **HAL_RTC** _Real Time Clock_ to handle date and time in `scheduler.c`
|
|
55 - **HAL_SPI** _Serial Peripheral Interface_: implement the [standard protocol](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus). Used to do full duplex communication between the two CPUs. In `spi.c`, SPI1 is used to communicate to the maon CPU, and SPI3 to commicate to buttons.
|
|
56 - **HAL_UART** _Universal Asynchronous Receiver Transmitter_: serial communications used in `uart.c` |