This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b9d535ce6 boards/b-g431b-esc1: configure CAN_TERM pin also for 
SocketCAN interface
5b9d535ce6 is described below

commit 5b9d535ce6d7089a55742a748d7111f31ec74204
Author: raiden00pl <[email protected]>
AuthorDate: Thu Feb 13 11:44:53 2025 +0100

    boards/b-g431b-esc1: configure CAN_TERM pin also for SocketCAN interface
    
    boards/b-g431b-esc1: configure CAN_TERM pin also for SocketCAN interface
    
    Signed-off-by: raiden00pl <[email protected]>
---
 boards/arm/stm32/b-g431b-esc1/src/stm32_cansock.c | 25 +++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/boards/arm/stm32/b-g431b-esc1/src/stm32_cansock.c 
b/boards/arm/stm32/b-g431b-esc1/src/stm32_cansock.c
index 964ecd4172..1b7b8f8f4e 100644
--- a/boards/arm/stm32/b-g431b-esc1/src/stm32_cansock.c
+++ b/boards/arm/stm32/b-g431b-esc1/src/stm32_cansock.c
@@ -29,6 +29,23 @@
 #include <debug.h>
 
 #include "stm32_fdcan.h"
+#include "b-g431b-esc1.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#if !defined(CONFIG_STM32_FDCAN1)
+#  error "No CAN is enable. Please eneable at least one CAN device"
+#endif
+
+#ifdef CONFIG_BOARD_STM32_BG431BESC1_CANTERM
+#  define BG431BESC1_CANTERM (true)
+#else
+#  define BG431BESC1_CANTERM (false)
+#endif
 
 /****************************************************************************
  * Public Functions
@@ -55,5 +72,13 @@ int stm32_cansock_setup(void)
       return ret;
     }
 
+  /* Configure CAN_TERM pin for output */
+
+  stm32_configgpio(GPIO_CANTERM);
+
+  /* Set CAN_TERM pin high or low */
+
+  stm32_gpiowrite(GPIO_CANTERM, BG431BESC1_CANTERM);
+
   return OK;
 }

Reply via email to