Use HSI with CAN-based time synchronization

This commit is contained in:
jazzpi
2022-07-31 00:54:36 +02:00
parent dc40179461
commit 171d3e40cd
9 changed files with 143 additions and 50 deletions

View File

@ -17,6 +17,7 @@
#include <stdint.h>
#define CAN_ID_SLAVE_ERROR 0x001
#define CAN_ID_TIME_SYNC 0x002
#define CAN_ID_AMS_SLAVE_HEARTBEAT_BASE 0x600
#define CAN_HEARTBEAT_TX_TIMEOUT 10 /* ms */

13
Core/Inc/TimeSync.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef INC_TIME_SYNC_H_
#define INC_TIME_SYNC_H_
#define TARGET_FREQ 16000000 // Hz
#define TRIM_FREQ 48000 // Hz
#define TIME_SYNC_INTERVAL 1000 // ms
#define RCC_CR_HSITRIM_MAX 31
#define STARTUP_TIME_SYNC_TIME 5000 // ms
void time_sync_handle_frame();
#endif // INC_TIME_SYNC_H_