Custom SERIAL_SPEED
- Dominant language
- C
- Stars
- 343
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am trying to use SiK on a HM-TRP in order to transmit a 76800 bps UART over the air.
76800 bps is not in the known SERIAL_SPEED, so I modified serial.c to add it's support :
```c
static const __code struct {
uint8_t rate;
uint8_t th1;
uint8_t ckcon;
} serial_rates[] = {
{1, 0x2C, 0x02}, // 1200
{2, 0x96, 0x02}, // 2400
{4, 0x2C, 0x00}, // 4800
{9, 0x96, 0x00}, // 9600
{19, 0x60, 0x01}, // 19200
{38, 0xb0, 0x01}, // 38400
{57, 0x2b, 0x08}, // 57600 - default
{115, 0x96, 0x08}, // 115200
{76, 0x61, 0x08}, // 76800 - replace the 203400
};
```
After compiling and firmware upload, I can select this new speed with AT commands. But after save eeprom and reboot, i am not able anymore to access AT mode by sending '+++' at 76800 bps...
Did I do something wrong ?
As long as the Si1000 UART baud rate is controled by the Timer1 Overflow, setting the TH1 register to 0x61 should do the job. Si1000 datasheet give the formula `UartBaudRate = T1CLK / (2 * (256 - TH1))` so with a T1CLK of 24.5 MHz, this should give a good 77044 bps so only -0.32% error...
Note : I have Mavlink framing disabled.
Maybe should I stay on 1.9 stable release ?
Anyone tryed these intermediate but still standard baud rates ?
I know how to force bootloader mode at startup in order to upload again FW, but what baud rate should I use now ?
Thanks,
Georges
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with serial.c and the serial_rates table shown in the report, then trace how the selected rate is stored and restored across EEPROM save and reboot. Reproduce the 76800-baud AT-mode failure and verify the bootloader recovery path; done means determining whether the custom rate can reliably survive reboot and identifying the documented recovery baud rate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100