summaryrefslogtreecommitdiff
path: root/nuttx/configs/sam4e-ek/src/sam_boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/configs/sam4e-ek/src/sam_boot.c')
-rw-r--r--nuttx/configs/sam4e-ek/src/sam_boot.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/nuttx/configs/sam4e-ek/src/sam_boot.c b/nuttx/configs/sam4e-ek/src/sam_boot.c
index 4bed7b2a2..5f6216366 100644
--- a/nuttx/configs/sam4e-ek/src/sam_boot.c
+++ b/nuttx/configs/sam4e-ek/src/sam_boot.c
@@ -47,7 +47,7 @@
#include "sam4e-ek.h"
/************************************************************************************
- * Definitions
+ * Pre-processor Definitions
************************************************************************************/
/************************************************************************************
@@ -55,6 +55,31 @@
************************************************************************************/
/************************************************************************************
+ * Name: board_config_usart1
+ *
+ * Description:
+ * USART1: To avoid any electrical conflict, the RS232 and RS485 transceiver are
+ * isolated from the receiving line PA21.
+ *
+ * - Chose RS485 channel: Close 1-2 pins on JP11 and set PA23 to high level
+ * - Chose RS232 channel: Close 2-3 pins on JP11 and set PA23 to low level
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_SAM34_USART1
+static inline void board_config_usart1(void)
+{
+#if defined(CONFIG_USART1_ISUART)
+ (void)sam_configgpio(GPIO_RS232_ENABLE);
+#else /* if defined(CONFIG_USART1_RS485) */
+ (void)sam_configgpio(GPIO_RS485_ENABLE);
+#endif
+}
+#else
+# define board_config_usart1()
+#endif
+
+/************************************************************************************
* Public Functions
************************************************************************************/
@@ -70,6 +95,10 @@
void sam_boardinitialize(void)
{
+ /* Configure USART1 for RS-232/RS-485 operation */
+
+ board_config_usart1();
+
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
* sam_spiinitialize() has been brought into the link.
*/