This commit is contained in:
Valentin Dabstep 2025-05-30 15:53:15 +03:00
parent 31528a4a5b
commit f1d922bd34
4 changed files with 19 additions and 25 deletions

View file

@ -7,6 +7,7 @@ debug_tool = stlink
monitor_speed = 19200
monitor_parity = N
board_upload.offset_address = 0x08008000
board_build.ldscript = ${PROJECT_DIR}/custom_script.ld
build_flags =
@ -14,11 +15,10 @@ build_flags =
-D HAL_CAN_MODULE_ENABLED
-D SIMPLEFOC_PWM_LOWSIDE_ACTIVE_HIGH
lib_deps =
askuric/Simple FOC@^2.3.4
pazi88/STM32_CAN@^1.1.2
extra_scripts =
pre:gen_compile_commands.py
post:hex_compile.py
post:hex_compile.py

View file

@ -63,13 +63,13 @@ volatile uint32_t ipsr_value = 0;
void setup(){
// Vector table initialization (commented out)
SCB->VTOR = (uint32_t)0x08008004;
SCB->VTOR = (volatile uint32_t)0x08008004;
Serial.setRx(HARDWARE_SERIAL_RX_PIN);
Serial.setTx(HARDWARE_SERIAL_TX_PIN);
Serial.begin(115200);
// pinMode(PC11, OUTPUT);
pinMode(PC11, OUTPUT);
pinMode(PC10,OUTPUT);
GPIOC->ODR &= ~GPIO_ODR_OD10;
// Can.enableMBInterrupts();
@ -111,11 +111,12 @@ void loop() {
// // Process incoming CAN messages
while (Can.read(msg)) {
listen_can(msg);
CAN_GET = true;
}
/* If receive data from CAN */
if(CAN_GET) {
listen_can(msg);
CAN_GET = false;
}
}

View file

@ -6,7 +6,7 @@ static CAN_message_t CAN_inMsg;
template <typename T>
void send_can_with_id_crc(uint8_t id, uint8_t message_type, const T* data) {
void send_can_with_id_crc(uint8_t id, uint8_t message_type, T* data) {
// Create CAN message
CAN_message_t msg_l;
msg_l.id = id;
@ -76,7 +76,6 @@ void send_id() {
uint8_t id = flash_rec[addr_id].value;
send_can_with_id_crc(id,'I',&id);
__NOP();
}
// void send_motor_torque() {