Skip to content

Board HC12

Thomas edited this page May 1, 2017 · 3 revisions

HC12 RF Modem Module

STM8S003F3 Pin Assignment

List from al177/stm8ef:

Pin# Function board pin/signal
1 PD4 Si4463 p1 - SDN
2 PD5/UART1_TX header TXD pad via level shifter
3 PD6/UART1_RX header RXD pad via level shifter
4 nRST reset test point nearest header RXD pad
11 PB5 header SET pad via level shifter
12 PB4 Si4463 p9 - GPIO0
13 PC3 Si4463 p10 - GPIO1
14 PC4 Si4463 p11 - nIRQ
15 PC5/SPI_SCK Si4463 p12 - SCLK
16 PC6/SPI_MOSI Si4463 p14 - SDI
17 PC7/SPI_MISO Si4463 p13 - SDO
18 PD1/SWIM SWIM test point nearest header TXD pad
19 PD2 Si4463 p15 - nSEL

GPIO_PIN_CFG

Command 0x13 GPIO_PIN_CFG: configuration if the GPIO pins 0x60,0x48,0x57,0x56,0x5A,0x4B.

Pin Init Pullup Mode Mode Description
GPIO0 0x60 1 32 High while in the transmit state.
GPIO1 0x48 1 8 CTS. Output High when clear to send a new command, output low otherwise.
GPIO2 0x57 1 23 Antenna 2 Switch used for antenna diversity.
GPIO3 0x56 1 22 Antenna 1 Switch used for antenna diversity.
NIRQ 0x5A 1 26 High when a sync word is detected. Returns to output low after the packet is received.
SDO 0x4B 1 11 SPI. Serial data out.

Note: before transmit, the configuration of GPIO2 and GPIO3 is swapped, and swapped back again after transmission. This is not entirely surprising since antenna diversity has nothing to do with the RX/TX switch on the PCB.

Startup Sequence

HC12 init in default mode (verified values):

0,0x02,0x01,0x00,0x01,0xC9,0xC3,0x80
1,0x13,0x60,0x48,0x57,0x56,0x5A,0x4B

2,0x11,0x00,0x01,0x00,0x48
3,0x11,0x00,0x01,0x03,0x40
4,0x11,0x01,0x01,0x00,0x00
5,0x11,0x02,0x04,0x00,0x03,0x07,0x00,0x00
6,0x11,0x10,0x09,0x00,0x06,0x14,0x00,0x50,0x31,0x00,0x00,0x00,0x00
7,0x11,0x11,0x05,0x00,0x21,0x89,0x89,0x00,0x00
8,0x11,0x12,0x01,0x00,0x81
9,0x11,0x12,0x01,0x06,0x02
10,0x11,0x12,0x03,0x08,0x00,0x00,0x00
11,0x11,0x12,0x0C,0x0D,0x00,0x40,0x06,0xAA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
12,0x11,0x12,0x08,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
13,0x11,0x20,0x0C,0x00,0x03,0x00,0x07,0x26,0x25,0xA0,0x01,0xC9,0xC3,0x80,0x00,0x22
14,0x11,0x20,0x01,0x0C,0x22
15,0x11,0x20,0x08,0x18,0x01,0x00,0x08,0x03,0x80,0x00,0x00,0x30
16,0x11,0x20,0x09,0x22,0x00,0x78,0x04,0x44,0x44,0x04,0x44,0x02,0x00
17,0x11,0x20,0x07,0x2C,0x00,0x23,0x8F,0xFF,0x00,0xDE,0xA0
18,0x11,0x20,0x01,0x35,0xE2
19,0x11,0x20,0x09,0x38,0x22,0x0D,0x0D,0x00,0x1A,0x40,0x00,0x00,0x28
20,0x11,0x20,0x0B,0x42,0xA4,0x03,0xD6,0x03,0x01,0x0A,0x01,0x80,0xFF,0x0C,0x00
21,0x11,0x20,0x01,0x4E,0x40
22,0x11,0x20,0x01,0x51,0x0A
23,0x11,0x21,0x0C,0x00,0x5B,0x47,0x0F,0xC0,0x6D,0x25,0xF4,0xDB,0xD6,0xDF,0xEC,0xF7
24,0x11,0x21,0x0C,0x0C,0xFE,0x01,0x15,0xF0,0xFF,0x03,0x5B,0x47,0x0F,0xC0,0x6D,0x25
25,0x11,0x21,0x0C,0x18,0xF4,0xDB,0xD6,0xDF,0xEC,0xF7,0xFE,0x01,0x15,0xF0,0xFF,0x03
26,0x11,0x22,0x04,0x00,0x08,0x7F,0x00,0x5D
27,0x11,0x23,0x07,0x00,0x01,0x05,0x0B,0x05,0x02,0x00,0x03
28,0x11,0x30,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
29,0x11,0x40,0x08,0x00,0x38,0x0D,0xDD,0xDD,0x36,0x9D,0x20,0xFE

30,0x20,0x00,0x00,0x00

31,0x11,0x20,0x0C,0x00,0x03,0x00,0x07,0x00,0xEA,0x60,0x04,0x2D,0xC6,0xC0,0x00,0x04
32,0x11,0x20,0x01,0x0C,0x19
33,0x11,0x20,0x08,0x18,0x01,0x80,0x08,0x03,0x80,0x00,0x20,0x10
34,0x11,0x20,0x09,0x22,0x00,0xA7,0x03,0x12,0x6F,0x01,0x88,0x02,0xC2
35,0x11,0x20,0x07,0x2C,0x04,0x36,0x80,0x2C,0x07,0xE9,0x80
36,0x11,0x20,0x09,0x38,0x11,0x25,0x25,0x00,0x1A,0x80,0x00,0x00,0x29
37,0x11,0x20,0x0B,0x42,0xA4,0x02,0xD6,0x83,0x01,0x44,0x01,0x80,0xFF,0x0C,0x00
38,0x11,0x21,0x0C,0x00,0xCC,0xA1,0x30,0xA0,0x21,0xD1,0xB9,0xC9,0xEA,0x05,0x12,0x11
39,0x11,0x21,0x0C,0x0C,0x0A,0x04,0x15,0xFC,0x03,0x00,0xCC,0xA1,0x30,0xA0,0x21,0xD1
40,0x11,0x21,0x0C,0x18,0xB9,0xC9,0xEA,0x05,0x12,0x11,0x0A,0x04,0x15,0xFC,0x03,0x00
41,0x11,0x22,0x04,0x00,0x08,0x7F,0x00,0x3D
42,0x11,0x23,0x07,0x00,0x2C,0x0E,0x0B,0x04,0x0C,0x73,0x03
43,0x11,0x22,0x01,0x01,0x7F

44,0x15,0x00
45,0x44,0xFF
46,0x44,0xFF
47,0x44,0xFF,0xFF,0xFF
48,0x33
49,0x44,0xFF
49,0x44,0xFF,0xFF,0xFF,0xFF
50,0x44,0xFF,0xFF,0xFF,0xFF
51,0x32,0x02,0x00,0x00,0x14,0x00,0x01,0x03
Clone this wiki locally