mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
arch/arm/src/stm32f7/stm32_can.c: Fix bittiming calculation.
This commit is contained in:
committed by
Gregory Nutt
parent
91bb1f0b9f
commit
5645cb5e51
@@ -63,7 +63,8 @@
|
|||||||
#include "stm32_gpio.h"
|
#include "stm32_gpio.h"
|
||||||
|
|
||||||
#if defined(CONFIG_CAN) && \
|
#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
|
* Pre-processor Definitions
|
||||||
@@ -1739,8 +1740,8 @@ static int stm32can_bittiming(FAR struct stm32_can_s *priv)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ts1 = CONFIG_STM32_CAN_TSEG1;
|
ts1 = CONFIG_STM32F7_CAN_TSEG1;
|
||||||
ts2 = CONFIG_STM32_CAN_TSEG2;
|
ts2 = CONFIG_STM32F7_CAN_TSEG2;
|
||||||
brp = (tmp + (CAN_BIT_QUANTA / 2)) / CAN_BIT_QUANTA;
|
brp = (tmp + (CAN_BIT_QUANTA / 2)) / CAN_BIT_QUANTA;
|
||||||
DEBUGASSERT(brp >= 1 && brp <= CAN_BTR_BRP_MAX);
|
DEBUGASSERT(brp >= 1 && brp <= CAN_BTR_BRP_MAX);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,24 +72,24 @@
|
|||||||
|
|
||||||
/* User-defined TSEG1 and TSEG2 settings may be used.
|
/* User-defined TSEG1 and TSEG2 settings may be used.
|
||||||
*
|
*
|
||||||
* CONFIG_STM32_CAN_TSEG1 = the number of CAN time quanta in segment 1
|
* CONFIG_STM32F7_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_TSEG2 = the number of CAN time quanta in segment 2
|
||||||
* CAN_BIT_QUANTA = The number of CAN time quanta in on bit time
|
* CAN_BIT_QUANTA = The number of CAN time quanta in on bit time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_STM32_CAN_TSEG1
|
#ifndef CONFIG_STM32F7_CAN_TSEG1
|
||||||
# define CONFIG_STM32_CAN_TSEG1 6
|
# define CONFIG_STM32F7_CAN_TSEG1 6
|
||||||
#endif
|
#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"
|
# errror "CONFIG_STM32_CAN_TSEG1 is out of range"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_STM32_CAN_TSEG2
|
#ifndef CONFIG_STM32F7_CAN_TSEG2
|
||||||
# define CONFIG_STM32_CAN_TSEG2 7
|
# define CONFIG_STM32F7_CAN_TSEG2 7
|
||||||
#endif
|
#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"
|
# errror "CONFIG_STM32_CAN_TSEG2 is out of range"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user