Compare commits
No commits in common. "b024569ca4780a66488bbad9aead688a989bfec8" and "9f728f91604e36fc6dcc06a45b89e310e74bdba4" have entirely different histories.
b024569ca4
...
9f728f9160
37
CANEmu.ioc
37
CANEmu.ioc
@ -22,23 +22,22 @@ Mcu.IP7=USART1
|
||||
Mcu.IPNb=8
|
||||
Mcu.Name=STM32F103C(8-B)Tx
|
||||
Mcu.Package=LQFP48
|
||||
Mcu.Pin0=PC13-TAMPER-RTC
|
||||
Mcu.Pin1=PC14-OSC32_IN
|
||||
Mcu.Pin10=PA13
|
||||
Mcu.Pin11=PA14
|
||||
Mcu.Pin12=VP_IWDG_VS_IWDG
|
||||
Mcu.Pin13=VP_SYS_VS_Systick
|
||||
Mcu.Pin14=VP_TIM2_VS_ClockSourceINT
|
||||
Mcu.Pin15=VP_TIM3_VS_ClockSourceINT
|
||||
Mcu.Pin2=PC15-OSC32_OUT
|
||||
Mcu.Pin3=PD0-OSC_IN
|
||||
Mcu.Pin4=PD1-OSC_OUT
|
||||
Mcu.Pin5=PB0
|
||||
Mcu.Pin6=PA9
|
||||
Mcu.Pin7=PA10
|
||||
Mcu.Pin8=PA11
|
||||
Mcu.Pin9=PA12
|
||||
Mcu.PinsNb=16
|
||||
Mcu.Pin0=PC14-OSC32_IN
|
||||
Mcu.Pin1=PC15-OSC32_OUT
|
||||
Mcu.Pin10=PA14
|
||||
Mcu.Pin11=VP_IWDG_VS_IWDG
|
||||
Mcu.Pin12=VP_SYS_VS_Systick
|
||||
Mcu.Pin13=VP_TIM2_VS_ClockSourceINT
|
||||
Mcu.Pin14=VP_TIM3_VS_ClockSourceINT
|
||||
Mcu.Pin2=PD0-OSC_IN
|
||||
Mcu.Pin3=PD1-OSC_OUT
|
||||
Mcu.Pin4=PB0
|
||||
Mcu.Pin5=PA9
|
||||
Mcu.Pin6=PA10
|
||||
Mcu.Pin7=PA11
|
||||
Mcu.Pin8=PA12
|
||||
Mcu.Pin9=PA13
|
||||
Mcu.PinsNb=15
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F103C8Tx
|
||||
@ -73,8 +72,6 @@ PA9.Mode=Asynchronous
|
||||
PA9.Signal=USART1_TX
|
||||
PB0.Locked=true
|
||||
PB0.Signal=GPIO_Output
|
||||
PC13-TAMPER-RTC.Locked=true
|
||||
PC13-TAMPER-RTC.Signal=GPIO_Output
|
||||
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
||||
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||
@ -114,7 +111,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true,6-MX_CAN_Init-CAN-false-HAL-true,7-MX_IWDG_Init-IWDG-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_TIM2_Init-TIM2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-HAL-true
|
||||
RCC.ADCFreqValue=36000000
|
||||
RCC.AHBFreq_Value=72000000
|
||||
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
||||
|
@ -1,34 +0,0 @@
|
||||
#ifndef CANCONFIG_H
|
||||
#define CANCONFIG_H
|
||||
|
||||
#define CAN_ONLY_EMULATING
|
||||
//#define CAN_ERROR_WITH_CORRECT_CRC
|
||||
|
||||
|
||||
// Настройки GPIO и таймера
|
||||
#define CANEMU_TX_GPIO_PORT GPIOA
|
||||
#define CANEMU_TX_GPIO_PIN 12
|
||||
#define CANEMU_TIM TIM2
|
||||
#define CANEMU_TIM_US_TICKS 72 // Для 1 мкс при 72 МГц
|
||||
#define CANEMU_TIM_CLOCK_HZ 72000000UL // частота таймера
|
||||
#define CAN_MIN_PERIOD 20
|
||||
#define LED_WORKING(on_off) \
|
||||
do { \
|
||||
if (!on_off) GPIOC->ODR |= (1U << 13); \
|
||||
else GPIOC->ODR &= ~(1U << 13); \
|
||||
} while (0)
|
||||
// === Макросы управления GPIO ===
|
||||
|
||||
#define can_tx_set_1() (CANEMU_TX_GPIO_PORT->BSRR = (1U << CANEMU_TX_GPIO_PIN))
|
||||
#define can_tx_set_0() (CANEMU_TX_GPIO_PORT->BRR = (1U << CANEMU_TX_GPIO_PIN))
|
||||
|
||||
// === Макросы управления таймером ===
|
||||
|
||||
#define tim_reset(TIM) ((TIM)->CNT = 0)
|
||||
#define tim_get(TIM) ((uint16_t)(TIM)->CNT)
|
||||
#define tim_start(TIM) ((TIM)->CR1 |= TIM_CR1_CEN)
|
||||
#define tim_stop(TIM) ((TIM)->CR1 &= ~TIM_CR1_CEN)
|
||||
|
||||
|
||||
|
||||
#endif // CANEMU_H
|
@ -1,8 +1,12 @@
|
||||
#include "canEmu.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "rs_message.h"
|
||||
|
||||
volatile uint32_t CANEMU_BIT_TICKS = 0;
|
||||
CANEmu_HandleTypeDef hcanemu;
|
||||
|
||||
int flag_manual = 0;
|
||||
int transmit_prev = 0;
|
||||
|
||||
static void delay_us(uint32_t us) {
|
||||
uint32_t ticks = us * CANEMU_TIM_US_TICKS;
|
||||
@ -25,7 +29,7 @@ void CANEmu_Init(CANEmu_HandleTypeDef *canemu, uint32_t bitrate) {
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
/*Configure GPIO pin */
|
||||
/*Configure GPIO pin : PB0 */
|
||||
GPIO_InitStruct.Pin = (1<<CANEMU_TX_GPIO_PIN);
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
@ -41,7 +45,6 @@ void CANEmu_Init(CANEmu_HandleTypeDef *canemu, uint32_t bitrate) {
|
||||
canemu->bitrate_bps = bitrate;
|
||||
tim_start(CANEMU_TIM);
|
||||
can_tx_set_1(); // Recessive level
|
||||
canemu->EmuFlag = 1;
|
||||
}
|
||||
|
||||
void wait_exact_ticks(uint16_t target_ticks) {
|
||||
@ -56,9 +59,6 @@ void wait_exact_ticks(uint16_t target_ticks) {
|
||||
|
||||
void CANEmu_SendFrame(CANEmu_HandleTypeDef *canemu) {
|
||||
if (canemu->bitrate_bps == 0) return;
|
||||
#ifdef LED_WORKING
|
||||
LED_WORKING(1);
|
||||
#endif
|
||||
|
||||
form_CAN_bitstream_full(&canemu->header, canemu->data, canemu->errors);
|
||||
|
||||
@ -80,7 +80,61 @@ void CANEmu_SendFrame(CANEmu_HandleTypeDef *canemu) {
|
||||
|
||||
can_tx_set_1(); // Завершаем линию
|
||||
__enable_irq();
|
||||
#ifdef LED_WORKING
|
||||
LED_WORKING(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CANEmu_Working(CANEmu_HandleTypeDef *canemu)
|
||||
{
|
||||
|
||||
if(flag_manual == 0)
|
||||
{
|
||||
canemu->start_poll = MB_DATA.Coils.START_POLLING;
|
||||
canemu->transmit = MB_DATA.Coils.START_SINGLE_FRAME;
|
||||
canemu->period_ms = MB_DATA.HoldRegs.CAN_PERIOD;
|
||||
if(canemu->period_ms < CAN_MIN_PERIOD)
|
||||
{
|
||||
canemu->period_ms = CAN_MIN_PERIOD;
|
||||
}
|
||||
// can message
|
||||
canemu->header.IDE = MB_DATA.Coils.HEADER_IDE;
|
||||
canemu->header.RTR = MB_DATA.Coils.HEADER_RTR;
|
||||
canemu->bitrate_bps = (uint32_t)MB_DATA.HoldRegs.CAN_BITRATE_KBPS*1000;
|
||||
canemu->header.ExtId = ((uint32_t)MB_DATA.HoldRegs.CAN_ID_HI << 16) | MB_DATA.HoldRegs.CAN_ID_LO;
|
||||
canemu->header.StdId = canemu->header.ExtId;
|
||||
canemu->header.DLC = (uint8_t)MB_DATA.HoldRegs.CAN_DLC & 0xF;
|
||||
canemu->data[0] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_0;
|
||||
canemu->data[1] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_1;
|
||||
canemu->data[2] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_2;
|
||||
canemu->data[3] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_3;
|
||||
canemu->data[4] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_4;
|
||||
canemu->data[5] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_5;
|
||||
canemu->data[6] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_6;
|
||||
canemu->data[7] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_7;
|
||||
|
||||
// errors
|
||||
canemu->errors.FF_SRS = MB_DATA.Coils.FLIP_SRS;
|
||||
canemu->errors.FF_IDE = MB_DATA.Coils.FLIP_IDE;
|
||||
canemu->errors.FF_RTR = MB_DATA.Coils.FLIP_RTR;
|
||||
canemu->errors.FF_R1 = MB_DATA.Coils.FLIP_R1;
|
||||
canemu->errors.FF_R0 = MB_DATA.Coils.FLIP_R0;
|
||||
canemu->errors.MSGID = MB_DATA.Coils.FLIP_MSGID_BIT;
|
||||
canemu->errors.DATA = MB_DATA.Coils.FLIP_DATA_BIT;
|
||||
canemu->errors.CRC_ERR = MB_DATA.Coils.FLIP_CRC_BIT;
|
||||
canemu->errors.STUFF_BITS = MB_DATA.Coils.DISABLE_STUFF_BITS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(canemu->start_poll)
|
||||
{
|
||||
canemu->transmit = 0;
|
||||
HAL_Delay(canemu->period_ms);
|
||||
CANEmu_SendFrame(&hcanemu);
|
||||
}
|
||||
else if((canemu->transmit == 1) && (transmit_prev == 0))
|
||||
{
|
||||
CANEmu_SendFrame(&hcanemu);
|
||||
}
|
||||
transmit_prev = canemu->transmit;
|
||||
}
|
||||
|
@ -3,7 +3,25 @@
|
||||
|
||||
#include "canform.h"
|
||||
#include "tim.h"
|
||||
#include "canConfig.h"
|
||||
|
||||
// Настройки GPIO и таймера
|
||||
#define CANEMU_TX_GPIO_PORT GPIOB
|
||||
#define CANEMU_TX_GPIO_PIN 0
|
||||
#define CANEMU_TIM TIM2
|
||||
#define CANEMU_TIM_US_TICKS 72 // Для 1 мкс при 72 МГц
|
||||
#define CANEMU_TIM_CLOCK_HZ 72000000UL // частота таймера
|
||||
#define CAN_MIN_PERIOD 20
|
||||
// === Макросы управления GPIO ===
|
||||
|
||||
#define can_tx_set_1() (CANEMU_TX_GPIO_PORT->BSRR = (1U << CANEMU_TX_GPIO_PIN))
|
||||
#define can_tx_set_0() (CANEMU_TX_GPIO_PORT->BRR = (1U << CANEMU_TX_GPIO_PIN))
|
||||
|
||||
// === Макросы управления таймером ===
|
||||
|
||||
#define tim_reset(TIM) ((TIM)->CNT = 0)
|
||||
#define tim_get(TIM) ((uint16_t)(TIM)->CNT)
|
||||
#define tim_start(TIM) ((TIM)->CR1 |= TIM_CR1_CEN)
|
||||
#define tim_stop(TIM) ((TIM)->CR1 &= ~TIM_CR1_CEN)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -14,7 +32,6 @@ typedef struct
|
||||
uint32_t transmit;
|
||||
uint32_t period_ms;
|
||||
CAN_ErrorFlags_t errors;
|
||||
unsigned EmuFlag;
|
||||
}CANEmu_HandleTypeDef;
|
||||
extern CANEmu_HandleTypeDef hcanemu;
|
||||
|
||||
|
@ -1,95 +0,0 @@
|
||||
#include "canWorking.h"
|
||||
|
||||
CANEmu_HandleTypeDef hcanemu;
|
||||
uint32_t mbox;
|
||||
|
||||
CANEmu_HandleTypeDef hcanemu;
|
||||
int flag_manual = 0;
|
||||
int transmit_prev = 0;
|
||||
|
||||
void CAN_Init(CANEmu_HandleTypeDef *canemu)
|
||||
{
|
||||
#ifdef CAN_ONLY_EMULATING
|
||||
if(canemu->EmuFlag == 0)
|
||||
{
|
||||
CANEmu_Init(canemu, canemu->bitrate_bps);
|
||||
}
|
||||
#else
|
||||
if(canemu->errors.all && (canemu->EmuFlag == 0))
|
||||
{
|
||||
CANEmu_Init(canemu, canemu->bitrate_bps);
|
||||
}
|
||||
else if ((canemu->errors.all == 0) && canemu->EmuFlag)
|
||||
{
|
||||
canemu->EmuFlag = 0;
|
||||
HAL_CAN_MspInit(&hcan);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CAN_SendFrame(CANEmu_HandleTypeDef *canemu)
|
||||
{
|
||||
#ifdef CAN_ONLY_EMULATING
|
||||
CANEmu_SendFrame(canemu);
|
||||
#else
|
||||
if(canemu->EmuFlag)
|
||||
CANEmu_SendFrame(canemu);
|
||||
else
|
||||
HAL_CAN_AddTxMessage(&hcan, &canemu->header, canemu->data, &mbox);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CANEmu_Working(CANEmu_HandleTypeDef *canemu)
|
||||
{
|
||||
if(flag_manual == 0)
|
||||
{
|
||||
canemu->start_poll = MB_DATA.Coils.START_POLLING;
|
||||
canemu->transmit = MB_DATA.Coils.START_SINGLE_FRAME;
|
||||
canemu->period_ms = MB_DATA.HoldRegs.CAN_PERIOD;
|
||||
if(canemu->period_ms < CAN_MIN_PERIOD)
|
||||
{
|
||||
canemu->period_ms = CAN_MIN_PERIOD;
|
||||
}
|
||||
// can message
|
||||
canemu->header.IDE = MB_DATA.Coils.HEADER_IDE;
|
||||
canemu->header.RTR = MB_DATA.Coils.HEADER_RTR;
|
||||
canemu->bitrate_bps = (uint32_t)MB_DATA.HoldRegs.CAN_BITRATE_KBPS*1000;
|
||||
canemu->header.ExtId = ((uint32_t)MB_DATA.HoldRegs.CAN_ID_HI << 16) | MB_DATA.HoldRegs.CAN_ID_LO;
|
||||
canemu->header.StdId = canemu->header.ExtId;
|
||||
canemu->header.DLC = (uint8_t)MB_DATA.HoldRegs.CAN_DLC & 0xF;
|
||||
canemu->data[0] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_0;
|
||||
canemu->data[1] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_1;
|
||||
canemu->data[2] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_2;
|
||||
canemu->data[3] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_3;
|
||||
canemu->data[4] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_4;
|
||||
canemu->data[5] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_5;
|
||||
canemu->data[6] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_6;
|
||||
canemu->data[7] = (uint8_t)MB_DATA.HoldRegs.CAN_DATA_7;
|
||||
|
||||
// errors
|
||||
canemu->errors.bit.FF_SRS = MB_DATA.Coils.FLIP_SRS;
|
||||
canemu->errors.bit.FF_IDE = MB_DATA.Coils.FLIP_IDE;
|
||||
canemu->errors.bit.FF_RTR = MB_DATA.Coils.FLIP_RTR;
|
||||
canemu->errors.bit.FF_R1 = MB_DATA.Coils.FLIP_R1;
|
||||
canemu->errors.bit.FF_R0 = MB_DATA.Coils.FLIP_R0;
|
||||
canemu->errors.bit.MSGID = MB_DATA.Coils.FLIP_MSGID_BIT;
|
||||
canemu->errors.bit.DATA = MB_DATA.Coils.FLIP_DATA_BIT;
|
||||
canemu->errors.bit.CRC_ERR = MB_DATA.Coils.FLIP_CRC_BIT;
|
||||
canemu->errors.bit.STUFF_BITS = MB_DATA.Coils.DISABLE_STUFF_BITS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
CAN_Init(canemu);
|
||||
if(canemu->start_poll)
|
||||
{
|
||||
canemu->transmit = 0;
|
||||
HAL_Delay(canemu->period_ms);
|
||||
CAN_SendFrame(canemu);
|
||||
}
|
||||
else if((canemu->transmit == 1) && (transmit_prev == 0))
|
||||
{
|
||||
CAN_SendFrame(canemu);
|
||||
}
|
||||
transmit_prev = canemu->transmit;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
#ifndef CANWORKING_H
|
||||
#define CANWORKING_H
|
||||
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "can.h"
|
||||
#include "rs_message.h"
|
||||
#include "canEmu.h"
|
||||
|
||||
|
||||
void CANEmu_Working(CANEmu_HandleTypeDef *canemu);
|
||||
|
||||
#endif // CANEMU_H
|
@ -155,45 +155,31 @@ void form_CAN_bitstream_full(const CAN_TxHeaderTypeDef *header, const uint8_t *d
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef CAN_ERROR_WITH_CORRECT_CRC
|
||||
// Ошибки
|
||||
if (errors.bit.FF_SRS) flip_bit(srr_idx);
|
||||
if (errors.bit.FF_IDE) flip_bit(ide_idx);
|
||||
if (errors.bit.FF_RTR) flip_bit(rtr_idx);
|
||||
if (errors.bit.FF_R1) flip_bit(r1_idx);
|
||||
if (errors.bit.FF_R0) flip_bit(r0_idx);
|
||||
if (errors.bit.DATA) flip_bit(data_idx);
|
||||
// MSGID_ERR — переворачиваем 1-й бит ID (MSB ID[10]) для примера
|
||||
if (errors.bit.MSGID) flip_bit(id_start);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// 5. CRC
|
||||
uint16_t crc = compute_crc15(raw_bits, raw_len);
|
||||
uint32_t crc_start = raw_len;
|
||||
append_bits(raw_bits, &raw_len, crc, 15);
|
||||
|
||||
if (errors.bit.CRC_ERR) {
|
||||
if (errors.CRC_ERR) {
|
||||
flip_bit(crc_start); // инвертируем 1-й бит CRC для примера
|
||||
}
|
||||
|
||||
// 6. CRC Delimiter (recessive)
|
||||
append_bit(raw_bits, &raw_len, 1);
|
||||
|
||||
#ifndef CAN_ERROR_WITH_CORRECT_CRC
|
||||
// Ошибки
|
||||
if (errors.bit.FF_SRS) flip_bit(srr_idx);
|
||||
if (errors.bit.FF_IDE) flip_bit(ide_idx);
|
||||
if (errors.bit.FF_RTR) flip_bit(rtr_idx);
|
||||
if (errors.bit.FF_R1) flip_bit(r1_idx);
|
||||
if (errors.bit.FF_R0) flip_bit(r0_idx);
|
||||
if (errors.bit.DATA) flip_bit(data_idx);
|
||||
if (errors.FF_SRS) flip_bit(srr_idx);
|
||||
if (errors.FF_IDE) flip_bit(ide_idx);
|
||||
if (errors.FF_RTR) flip_bit(rtr_idx);
|
||||
if (errors.FF_R1) flip_bit(r1_idx);
|
||||
if (errors.FF_R0) flip_bit(r0_idx);
|
||||
if (errors.DATA) flip_bit(data_idx);
|
||||
// MSGID_ERR — переворачиваем 1-й бит ID (MSB ID[10]) для примера
|
||||
if (errors.bit.MSGID) flip_bit(id_start);
|
||||
#endif
|
||||
if (errors.MSGID) flip_bit(id_start);
|
||||
|
||||
// 10. Apply bit stuffing, пропускаем вставку stuff bits если ошибка ERR_STUFF_BITS
|
||||
apply_bit_stuffing_with_error(raw_bits, raw_len, can_bits, &can_bits_len, errors.bit.STUFF_BITS);
|
||||
apply_bit_stuffing_with_error(raw_bits, raw_len, can_bits, &can_bits_len, errors.STUFF_BITS);
|
||||
|
||||
// 7. ACK Slot (dominant)
|
||||
append_bit(can_bits, &can_bits_len, 1);
|
||||
|
@ -5,24 +5,19 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include "canConfig.h"
|
||||
|
||||
|
||||
typedef union {
|
||||
uint16_t all;
|
||||
struct
|
||||
{
|
||||
unsigned FF_SRS : 1; // Ошибка SRS бит (extended frame)
|
||||
unsigned FF_IDE : 1; // Ошибка IDE бит
|
||||
unsigned FF_RTR : 1; // Ошибка RTR бит
|
||||
unsigned FF_R1 : 1; // Ошибка r1 бит (reserved)
|
||||
unsigned FF_R0 : 1; // Ошибка r0 бит (reserved)
|
||||
unsigned MSGID : 1; // Ошибка битов ID
|
||||
unsigned DATA : 1; // Ошибка битов данных
|
||||
unsigned CRC_ERR : 1; // Ошибка битов CRC
|
||||
unsigned STUFF_BITS : 1; // Ошибка бит-стаффинга (пропуск вставки stuff bits)
|
||||
unsigned reserved : 7; // Зарезервировано
|
||||
}bit;
|
||||
typedef struct {
|
||||
uint16_t FF_SRS : 1; // Ошибка SRS бит (extended frame)
|
||||
uint16_t FF_IDE : 1; // Ошибка IDE бит
|
||||
uint16_t FF_RTR : 1; // Ошибка RTR бит
|
||||
uint16_t FF_R1 : 1; // Ошибка r1 бит (reserved)
|
||||
uint16_t FF_R0 : 1; // Ошибка r0 бит (reserved)
|
||||
uint16_t MSGID : 1; // Ошибка битов ID
|
||||
uint16_t DATA : 1; // Ошибка битов данных
|
||||
uint16_t CRC_ERR : 1; // Ошибка битов CRC
|
||||
uint16_t STUFF_BITS : 1; // Ошибка бит-стаффинга (пропуск вставки stuff bits)
|
||||
uint16_t reserved : 7; // Зарезервировано
|
||||
} CAN_ErrorFlags_t;
|
||||
|
||||
#ifndef IS_FUNCTIONAL_STATE
|
||||
|
@ -50,33 +50,15 @@ void MX_GPIO_Init(void)
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin : PC13 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_13;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PB0 */
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
|
||||
// /*Configure GPIO pin : PA9 */
|
||||
// GPIO_InitStruct.Pin = GPIO_PIN_9;
|
||||
// GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
// GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
// GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
// HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -148,7 +148,56 @@
|
||||
<Name>-U37FF71064E57343625581443 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL010000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>97</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134238940</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>../Core/Src/main.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\CANEmu\../Core/Src/main.c\97</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>1</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>193</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134235426</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>../Core/Src/stm32f1xx_it.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\CANEmu\../Core/Src/stm32f1xx_it.c\193</Expression>
|
||||
</Bp>
|
||||
<Bp>
|
||||
<Number>2</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>194</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>0</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>0</BreakIfRCount>
|
||||
<Filename>../Core/Src/stm32f1xx_it.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression></Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
@ -228,10 +277,6 @@
|
||||
<Name>System Viewer\GPIOA</Name>
|
||||
<WinId>35905</WinId>
|
||||
</Entry>
|
||||
<Entry>
|
||||
<Name>System Viewer\GPIOC</Name>
|
||||
<WinId>35904</WinId>
|
||||
</Entry>
|
||||
</SystemViewers>
|
||||
<DebugDescription>
|
||||
<Enable>1</Enable>
|
||||
@ -600,30 +645,6 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Core\CANEmu\canWorking.c</PathWithFileName>
|
||||
<FilenameWithoutPath>canWorking.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Core\CANEmu\canWorking.h</PathWithFileName>
|
||||
<FilenameWithoutPath>canWorking.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Core\CANEmu\canEmu.c</PathWithFileName>
|
||||
<FilenameWithoutPath>canEmu.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@ -631,7 +652,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -643,7 +664,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -655,7 +676,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -665,18 +686,6 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\Core\CANEmu\canConfig.h</PathWithFileName>
|
||||
<FilenameWithoutPath>canConfig.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
@ -687,7 +696,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -699,7 +708,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -711,7 +720,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -723,7 +732,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -735,7 +744,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -747,7 +756,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -759,7 +768,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>40</FileNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -771,7 +780,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -841,16 +841,6 @@
|
||||
<Group>
|
||||
<GroupName>CAN</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>canWorking.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Core\CANEmu\canWorking.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>canWorking.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Core\CANEmu\canWorking.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>canEmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@ -871,11 +861,6 @@
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Core\CANEmu\canform.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>canConfig.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\Core\CANEmu\canConfig.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
Loading…
Reference in New Issue
Block a user