arch/arm/src/stm32f7/stm32_can.c: Fix bittiming calculation.
This commit is contained in:
parent
91bb1f0b9f
commit
5645cb5e51
@ -63,7 +63,8 @@
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
#if defined(CONFIG_CAN) && \
|
||||
(defined(CONFIG_STM32F7_CAN1) || defined(CONFIG_STM32F7_CAN2))
|
||||
(defined(CONFIG_STM32F7_CAN1) || defined(CONFIG_STM32F7_CAN2) || \
|
||||
defined(CONFIG_STM32F7_CAN3))
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -1739,8 +1740,8 @@ static int stm32can_bittiming(FAR struct stm32_can_s *priv)
|
||||
|
||||
else
|
||||
{
|
||||
ts1 = CONFIG_STM32_CAN_TSEG1;
|
||||
ts2 = CONFIG_STM32_CAN_TSEG2;
|
||||
ts1 = CONFIG_STM32F7_CAN_TSEG1;
|
||||
ts2 = CONFIG_STM32F7_CAN_TSEG2;
|
||||
brp = (tmp + (CAN_BIT_QUANTA / 2)) / CAN_BIT_QUANTA;
|
||||
DEBUGASSERT(brp >= 1 && brp <= CAN_BTR_BRP_MAX);
|
||||
}
|
||||
|
@ -72,24 +72,24 @@
|
||||
|
||||
/* User-defined TSEG1 and TSEG2 settings may be used.
|
||||
*
|
||||
* CONFIG_STM32_CAN_TSEG1 = the number of CAN time quanta in segment 1
|
||||
* CONFIG_STM32_CAN_TSEG2 = the number of CAN time quanta in segment 2
|
||||
* CONFIG_STM32F7_CAN_TSEG1 = the number of CAN time quanta in segment 1
|
||||
* CONFIG_STM32F7_CAN_TSEG2 = the number of CAN time quanta in segment 2
|
||||
* CAN_BIT_QUANTA = The number of CAN time quanta in on bit time
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_STM32_CAN_TSEG1
|
||||
# define CONFIG_STM32_CAN_TSEG1 6
|
||||
#ifndef CONFIG_STM32F7_CAN_TSEG1
|
||||
# define CONFIG_STM32F7_CAN_TSEG1 6
|
||||
#endif
|
||||
|
||||
#if CONFIG_STM32_CAN_TSEG1 < 1 || CONFIG_STM32_CAN_TSEG1 > CAN_BTR_TSEG1_MAX
|
||||
#if CONFIG_STM32F7_CAN_TSEG1 < 1 || CONFIG_STM32F7_CAN_TSEG1 > CAN_BTR_TSEG1_MAX
|
||||
# errror "CONFIG_STM32_CAN_TSEG1 is out of range"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_CAN_TSEG2
|
||||
# define CONFIG_STM32_CAN_TSEG2 7
|
||||
#ifndef CONFIG_STM32F7_CAN_TSEG2
|
||||
# define CONFIG_STM32F7_CAN_TSEG2 7
|
||||
#endif
|
||||
|
||||
#if CONFIG_STM32_CAN_TSEG2 < 1 || CONFIG_STM32_CAN_TSEG2 > CAN_BTR_TSEG2_MAX
|
||||
#if CONFIG_STM32F7_CAN_TSEG2 < 1 || CONFIG_STM32F7_CAN_TSEG2 > CAN_BTR_TSEG2_MAX
|
||||
# errror "CONFIG_STM32_CAN_TSEG2 is out of range"
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user