Close

Initial thoughts

A project log for A Risc-V HC-12 433Mhz Serial Bridge

Updating the original HC-12 with a CH32V003

ozqubeOzQube 05/11/2023 at 23:010 Comments

The original HC-12 appears to come from the HC01 factory. Clones have been made of this module, some of which had bad quality components, which left the range much less than advertised!! (Search Hackaday for HC-12).

The module is simple and easy to use, but offered no expansion options. It wasn't designed to be reprogrammed easily. The STM8 micro has 1K of RAM and 8K of flash.

There has been a little bit of interest in reprogramming the original HC-12 module. Another Hackaday.io project log mentions it https://hackaday.io/project/16097-eforth-for-cheap-stm8s-gadgets/log/58808-starting-to-work-on-the-hc12 .

Recently, the WCH CH32V003  was released, with an almost identical  pinout to the STM8S used in the HC-12. It has double the RAM and flash, and has a 32-bit RISC-V core. I put out a post on EEVBLOG Forums suggesting someone should perform a swap on the HC-12 module, but noone took the bait! But rather than just perform a MCU swap, I wanted to make an improved version. So I placed my order for the chips and have now started the design.

The design goals are:

  1. Keep module small and simple to interface
  2. Make module compatible with 5V and 3.3V without external components
  3. Add expansion option
  4. Initially, make the new device compatible with the default settings of the original HC-12, then add other features later.

The original HC-12 has some limitations on the power side. The recommended power supply is 3.2-5.5V, however if feeding it >4.5v, then the manual suggests to add a diode on the input to (presumably) dissipate some heat through the diode due to the diode's voltage drop, which in turn reduces the voltage at the input of the LDO so it doesn't get too hot.

The UART interface is level shifted to the 3.3v/TTL level for the STM8, and has inline resistors for protection. 

My initial thoughts are to change the LDO to a buck/boost arrangement, which will be more efficient if being powered from higher voltages. Plus allow a 3.3v supply to be passed through.

On the UART side, maybe something like TI's TXU0202 which is a single chip solution for level shifting. 

Even though my new module is based on the HC-12, by developing a new pcb, the CH32V003F4P6 pins can be assigned in a slightly different way, allowing I2C pins to be available. I plan to put a QWIIC/Stemma QT  (JST SH) connector on the board to allow peripherals to be connected directly.

My next task is to figure out what the default settings are. The HC-12 manual says that the default mode is FU3, which has a UART speed of 9600bps (8,N,1) and an over-the-air data rate of 15,000 bps, Default frequency of 433.4 Mhz. The Si4463 radio IC has a complex API with alot of options to configure. Luckily, one of the developers of the eFourth adaptation for STM8 undertook the task of sniffing the SPI bus while the chip initialization was taking place. The list of commands is HERE .

I'm currently working through the list and cross referencing the API to understand what settings have been applied. 

Each line is a command sent to the radio IC. A quick summary is:

0x02 is the POWER_UP command.

0x13 configures the Radio IC GPIO pins

0x11 sets the radio parameters. (There are lots of these!)

A future post will have the breakdown. 

Discussions