This commit is contained in:
andreika-git 2024-03-12 14:38:52 +02:00 committed by rusefillc
parent 9aea203cc1
commit 094ca97373
2 changed files with 24 additions and 2 deletions

View File

@ -15,8 +15,26 @@ extern "C" {
// CAN1_RX: { PI9, PA11, PH14, PD0, PB8 }, CAN1_TX: { PA12, PH13, PD1, PB9 }
// CAN2_RX: { PB5, PB12 }, CAN2_TX: { PB6, PB13 }
#ifndef BOOT_COM_CAN_CHANNEL_INDEX
#error BOOT_COM_CAN_CHANNEL_INDEX is not defined.
#elif (BOOT_COM_CAN_CHANNEL_INDEX == 0)
#ifndef STM32_CAN_USE_CAN1
#error STM32_CAN_USE_CAN1 is not enabled for CAN index 0
#endif
#undef OPENBLT_CAND
#define OPENBLT_CAND CAND1
#elif (BOOT_COM_CAN_CHANNEL_INDEX == 1)
#ifndef STM32_CAN_USE_CAN2
#error STM32_CAN_USE_CAN2 is not enabled for CAN index 1
#endif
#undef OPENBLT_CAND
#define OPENBLT_CAND CAND2
#else
#error Unknown BOOT_COM_CAN_CHANNEL_INDEX.
#endif
#if !defined(OPENBLT_CAND) || !defined(OPENBLT_CAN_RX_PIN) || !defined(OPENBLT_CAN_RX_PORT) || !defined(OPENBLT_CAN_TX_PIN) || !defined(OPENBLT_CAN_TX_PORT)
#ifndef STM32_CAN_USE_CAN2
#ifdef STM32_CAN_USE_CAN2
#define OPENBLT_CAND CAND2
#define OPENBLT_CAN_RX_PORT GPIOB
#define OPENBLT_CAN_RX_PIN 5

View File

@ -84,7 +84,7 @@
*
*/
/** \brief Enable/disable CAN transport layer. */
#define BOOT_COM_CAN_ENABLE (0)
#define BOOT_COM_CAN_ENABLE (1)
/** \brief Configure the desired CAN baudrate. */
#define BOOT_COM_CAN_BAUDRATE (500000)
/** \brief Configure CAN message ID target->host. */
@ -95,6 +95,10 @@
#define BOOT_COM_CAN_RX_MSG_ID (0x667 /*| 0x80000000*/)
/** \brief Configure number of bytes in the host->target CAN message. */
#define BOOT_COM_CAN_RX_MAX_DATA (8)
/** \brief Select the desired CAN peripheral as a zero based index. */
#ifndef BOOT_COM_CAN_CHANNEL_INDEX
#define BOOT_COM_CAN_CHANNEL_INDEX (0)
#endif /* BOOT_COM_CAN_CHANNEL_INDEX */
/* The RS232 communication interface is selected by setting the BOOT_COM_RS232_ENABLE
* configurable to 1. Configurable BOOT_COM_RS232_BAUDRATE selects the communication speed