Hello to everyone,
I have a very simple question about the CAN configuration structure that is used in the DEMOs.
The structure is that one:
► Show Spoiler
static const CANConfig cancfg = {
CAN_MCR_ABOM | CAN_MCR_TXFP ,
CAN_BTR_SJW(0) | CAN_BTR_TS2(1) |
CAN_BTR_TS1(8) | CAN_BTR_BRP(6)
};
I just don't understand how to use the number in round parenthesis
The numerical values are defined in stm32f407xx.h, and it is not defined how to use those numbers. I am looking for some documentation, but i don't find it
► Show Spoiler
#define CAN_BTR_BRP ((uint32_t)0x000003FF) /*!<Baud Rate Prescaler */
#define CAN_BTR_TS1 ((uint32_t)0x000F0000) /*!<Time Segment 1 */
#define CAN_BTR_TS1_0 ((uint32_t)0x00010000) /*!<Bit 0 */
#define CAN_BTR_TS1_1 ((uint32_t)0x00020000) /*!<Bit 1 */
#define CAN_BTR_TS1_2 ((uint32_t)0x00040000) /*!<Bit 2 */
#define CAN_BTR_TS1_3 ((uint32_t)0x00080000) /*!<Bit 3 */
#define CAN_BTR_TS2 ((uint32_t)0x00700000) /*!<Time Segment 2 */
#define CAN_BTR_TS2_0 ((uint32_t)0x00100000) /*!<Bit 0 */
#define CAN_BTR_TS2_1 ((uint32_t)0x00200000) /*!<Bit 1 */
#define CAN_BTR_TS2_2 ((uint32_t)0x00400000) /*!<Bit 2 */
#define CAN_BTR_SJW ((uint32_t)0x03000000) /*!<Resynchronization Jump Width */
#define CAN_BTR_SJW_0 ((uint32_t)0x01000000) /*!<Bit 0 */
#define CAN_BTR_SJW_1 ((uint32_t)0x02000000) /*!<Bit 1 */
#define CAN_BTR_LBKM ((uint32_t)0x40000000) /*!<Loop Back Mode (Debug) */
#define CAN_BTR_SILM ((uint32_t)0x80000000) /*!<Silent Mode */
Thank you to everyone and have a nice day!