# Board Porting
### Board : SLSTK3400A
![](https://i.imgur.com/J0N3KZX.jpg)
* EFM32HG322F64 with 64 kB Flash and 8 kB RAM
* Integrated SEGGER J-Link USB debugger/emulator
* 128 x 128 Pixel Memory LCD
* 20 pin expansion header
* 2 user buttons, 2 user LEDs and 2 touch buttons
* Silicon Labs Si7021 Relative Humidity/Temperature sensor
* USB device interface
### Quick References
* [Schematic](https://www.silabs.com/documents/public/schematic-files/efm32hg-stk3400-schematics.pdf)
* [Board User Manual](https://www.silabs.com/documents/public/user-guides/ug255-stk3400-user-guide.pdf)
* [Chipset Datasheet](https://www.silabs.com/documents/public/data-sheets/efm32hg-datasheet.pdf)
* [Chipset Reference Manual](https://www.silabs.com/documents/public/reference-manuals/efm32hg-rm.pdf)
### Chipset : [EFM32HG322F64](https://www.silabs.com/documents/public/data-sheets/efm32hg-datasheet.pdf)
* 32-bit ARM Cortex-M0+ CPU (upto 25MHz)
* 64 kB Flash
* 8 kB RAM
* Up to 37 General Purpose I/O pins
* 6 Channel DMA Controller
* 6 Channel Peripheral Reflex System (PRS) for autonomous inter-peripheral signaling
* Hardware AES with 128-bit keys in 54 cycles
* Timers/Counters
* 3× 16-bit Timer/Counter
* 3×3 Compare/Capture/PWM channels
* Dead-Time Insertion on TIMER0
* 1× 24-bit Real-Time Counter
* 1× 16-bit Pulse Counter
* Watchdog Timer with dedicated RC oscillator @ 50 nA
* Communication interfaces
* Up to 2× Universal Synchronous/Asynchronous Receiver/Transmitter
* UART/SPI/SmartCard (ISO 7816)/IrDA/I2S
* Triple buffered full/half-duplex operation
* 1x Low Energy UART
* Autonomous operation with DMA in Deep Sleep Mode
* 1x I2C Interface with SMBus support
* Address recognition in Stop Mode
* 1x Low Energy Universal Serial Bus (USB) Device•
* Fully USB 2.0 compliant
* On-chip PHY and embedded 5V to 3.3V regulator
* Crystal-free operation
* Ultra low power precision analog peripherals
* 12-bit 1 Msamples/s Analog-to-Digital Converter
* 4 single-ended channels/2 differential channels
* On-chip temperature sensor [ADC Channel 0]
* Current Digital-to-Analog Converter
* Selectable current range between 0.05 and 64 μA
* 1× Analog Comparator
* Capacitive sensing with up to 5 inputs
* Supply Voltage Comparator
* Ultra efficient Power-on Reset and Brown-Out Detect
* Debug Interface
* 2-pin Serial Wire Debug interface
* Micro Trace Buffer (MTB)
* Pre-Programmed USB/UART Bootloader
* Single power supply 1.98 to 3.8 V
---
## Available implementations for reference
CPU - Cortex M0+ - [SAMD21](http://ww1.microchip.com/downloads/en/DeviceDoc/SAM_D21_DA1_Family_DataSheet_DS40001882F.pdf)
Peripherals - [EFM32LG Family](https://www.silabs.com/documents/public/data-sheets/efm32lg-datasheet.pdf) / [EFM32GG Family ](https://www.silabs.com/documents/public/data-sheets/efm32gg-datasheet.pdf)
---
## Porting Guide
1. Identify a similar board, in my case I opted for STK3700.
2. **Porting CPU** : Check if CPU support is available. If not then CPU might need to be ported, the procedure may be as follows
* Identify a similar MCU (EFM32GG in my case as its a part of [Series 0 MCU](https://www.silabs.com/documents/public/application-notes/an0002.0-efm32-ezr32-series-0-hardware-design-considerations.pdf))
* Copy the folder structure of `cpu/efm32/families/efm32gg` and create `cpu/efm32/families/efm32hg`
* Copy the `vendor/includes` from vendor's source. The source can be found in the local files installed during the setup of Simplicity studio for EFM32 series.
* Modify the `vectors.c` as per datasheet. Ref Table 4.1. Interrupt Request Lines (IRQ) in [Reference Manual](https://www.silabs.com/documents/public/reference-manuals/efm32hg-rm.pdf)
* `efm32-info.mk `needs to be modified based on the memory map.
* Modify rest of the files as required.
* Alternatively, the above procedures could be done using [EFM32 Generator](https://github.com/basilfx/EFM2Riot)
* Exposure to Kconfig can be done later. If required, follow Kconfig implementation from a similar CPU.
3. **Porting Board** Copy the folder structure of STK3700
4. Modify `doc.txt` as per datasheet and other files as required. Summary of peripherals can be found in product overview section in Reference manual.
5. Modify `board.h ` as per [board User manual](https://www.silabs.com/documents/public/user-guides/ug255-stk3400-user-guide.pdf).
6. Modify `periph_conf.h` with reference to peripherals listed in board manual .
* For LOCx values, refer 5.9.2 Alternate Functionality Pinout of EFM32HG322 in [datasheet](https://www.silabs.com/documents/public/data-sheets/efm32hg-datasheet.pdf)
* In the case of UART, make sure that the first reference is made to the USART used for the Virual Com Port.
## ACK
Thanks to Bas Stottelaar, Leandro Lanzieri and Kevin Weiss for the support.