# Programming

Here you will find the details needed for develop your own firmware for the device

If you are interested in writing firmware for the VALTRACK-V4-VTS device, you will need to know where is each pin of MCU is connected to.

Since the schematics of the device is not yet openly available, We are providing the MCU pin connection details, which should be able to help you in determining how is the whole architecture laid out. Watching our device intro video would also help to get an overall idea on the hardware present on board.

### MCU Pinout Details

<table data-header-hidden><thead><tr><th width="129"></th><th width="181"></th><th width="135"></th><th></th></tr></thead><tbody><tr><td><strong>Pin Number</strong></td><td><strong>Pin Name</strong></td><td><strong>Net Name</strong></td><td><strong>Connected to</strong></td></tr><tr><td>2, 3, 11, 17, 18, 31, 32</td><td>VDD3P3, VDD3P3_RTC, VDD3P3_CPU, VDD_SPI,         VDDA</td><td>3V3DC</td><td>3.3VDC output of LDO</td></tr><tr><td>19, 20, 21, 22, 23, 24</td><td>SPIHD, SPIWP, SPICS0, SPICLK, SPID, SPIQ</td><td>CLK_IN</td><td>32.768 KHz crystal</td></tr><tr><td>1</td><td>LNA_IN</td><td>RF_ANTENNA</td><td>Bluetooth / WiFi Chip antenna via matching network</td></tr><tr><td>4</td><td>GPIO0</td><td>LPUART1_TX</td><td>Cellular module RXD input pin through level translator.</td></tr><tr><td>5</td><td>GPIO1</td><td>LPUART1_RX</td><td>Cellular module TXD output pin through level translator.</td></tr><tr><td>6</td><td>GPIO2</td><td>ANALOG_IN</td><td><p>VCHG input through voltage divider resistor network.</p><ul><li>R22,R33 govern the voltage at this pin.</li><li>Default values : R22 = 100K, R33 = 3.3K</li></ul></td></tr><tr><td>7</td><td>CHIP_PU</td><td>CHIP_PU</td><td>CHIP_PU line </td></tr><tr><td>9</td><td>GPIO4</td><td>TPS_ENABLE</td><td><p>Enable input of switching regulator TPS54240</p><ul><li>Making this pin high powers the system via VCHG connector.</li></ul><p>This  will cause system into reset loop if no alternate backup battery power available <br><mark style="color:orange;"><strong>Do no activate this pin without connecting a 3,7V battery to avoid Race around condition</strong></mark></p></td></tr><tr><td>10</td><td>GPIO5</td><td>IIC_DATA</td><td>I2C data of LIS3DH Accelerometer </td></tr><tr><td>12</td><td>GPIO6</td><td>IIC_CLK</td><td>I2C clock of LIS3DH Accelerometer </td></tr><tr><td>13</td><td>GPIO7</td><td>SIM_PWRKEY_3V3</td><td><p>Cellular module PWRKEY pin through N channel MOSFET.</p><ul><li>Making this pin HIGH pulls PWRKEY pin to GND</li></ul></td></tr><tr><td>14</td><td>GPIO8</td><td>LED_SIGNAL</td><td>WS2812B battery LED input</td></tr><tr><td>15</td><td>GPIO9</td><td>GPIO9</td><td><p>Tactile switch input</p><ul><li>Pulled up, filtered and Active LOW</li></ul></td></tr><tr><td>16</td><td>GPIO10</td><td>GSM_ENABLE</td><td><p>Enable input of power gating MOSFET for Cellular module</p><ul><li>Making this pin high provides ~4VDC to Cellular module</li></ul></td></tr><tr><td>25</td><td>GPIO18</td><td>USB_DN</td><td>USB DP line</td></tr><tr><td>27</td><td>GPIO20</td><td>U0RXD</td><td>Drawn to test points</td></tr><tr><td>28</td><td>GPIO21</td><td>U0TXD</td><td>Drawn to test points</td></tr><tr><td>29</td><td>XTAL_N</td><td>OSC_OUT</td><td>40 MHz crystal</td></tr><tr><td>30</td><td>XTAL_P</td><td>OSC_IN</td><td>40 MHz crystal</td></tr><tr><td>26</td><td>GPIO19</td><td>USB_DP</td><td>USB DN line</td></tr><tr><td>33</td><td>GND</td><td>GND POWER PAD</td><td>GND</td></tr></tbody></table>

### J62 - VCHG Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                         |
| -------------- | ------------ | ---------------------------------------------------------------------------------------- |
| 1              | VCHG         | <p>VCHG input of system through FUSE and diode</p><ul><li>12VDC to 42VDC input</li></ul> |
| 2              | GND          | System Ground                                                                            |

### J41 - VBAT Connector \[SMT pads] - Pinout Details

| **Pin Number** | **Pin Name** | **Connected to**                                                                                |
| -------------- | ------------ | ----------------------------------------------------------------------------------------------- |
| 1              | VBAT         | <p>VBAT input of system or Backup battery input</p><ul><li>3.7V to 4.2V battery input</li></ul> |
| 2              | GND          | System Ground                                                                                   |
