|
| 1 | +/**************************************************************************** |
| 2 | + * boards/arm/stm32f0l0g0/nucleo-c092rc/include/board.h |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + * |
| 6 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 7 | + * contributor license agreements. See the NOTICE file distributed with |
| 8 | + * this work for additional information regarding copyright ownership. The |
| 9 | + * ASF licenses this file to you under the Apache License, Version 2.0 (the |
| 10 | + * "License"); you may not use this file except in compliance with the |
| 11 | + * License. You may obtain a copy of the License at |
| 12 | + * |
| 13 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | + * |
| 15 | + * Unless required by applicable law or agreed to in writing, software |
| 16 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 17 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 18 | + * License for the specific language governing permissions and limitations |
| 19 | + * under the License. |
| 20 | + * |
| 21 | + ****************************************************************************/ |
| 22 | + |
| 23 | +#ifndef __BOARDS_ARM_STM32F0L0G0_NUCLEO_C092RC_INCLUDE_BOARD_H |
| 24 | +#define __BOARDS_ARM_STM32F0L0G0_NUCLEO_C092RC_INCLUDE_BOARD_H |
| 25 | + |
| 26 | +/**************************************************************************** |
| 27 | + * Included Files |
| 28 | + ****************************************************************************/ |
| 29 | + |
| 30 | +#include <nuttx/config.h> |
| 31 | + |
| 32 | +#ifndef __ASSEMBLY__ |
| 33 | +# include <stdint.h> |
| 34 | +#endif |
| 35 | + |
| 36 | +/**************************************************************************** |
| 37 | + * Pre-processor Definitions |
| 38 | + ****************************************************************************/ |
| 39 | + |
| 40 | +/* Clocking *****************************************************************/ |
| 41 | + |
| 42 | +/* HSI - Internal 48 MHz RC Oscillator |
| 43 | + * LSI - 32 KHz RC |
| 44 | + * HSE - 8 MHz from MCO output of ST-LINK (disabled by default) |
| 45 | + * LSE - 32.768 kHz |
| 46 | + */ |
| 47 | + |
| 48 | +#define STM32_BOARD_XTAL 8000000ul /* 8MHz */ |
| 49 | + |
| 50 | +#define STM32_HSI_FREQUENCY 48000000ul /* 48MHz */ |
| 51 | +#define STM32_LSI_FREQUENCY 32000 /* Between 30kHz and 60kHz */ |
| 52 | +#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL |
| 53 | +#define STM32_LSE_FREQUENCY 32768 /* X2 on board */ |
| 54 | + |
| 55 | +/* Configure HSI48 clock division factor (48 MHz) */ |
| 56 | + |
| 57 | +#define STM32_RCC_HSIDIV RCC_CR_HSIDIV_HSI |
| 58 | + |
| 59 | +/* Use the HSI as SYSCLK source (48 MHz) */ |
| 60 | + |
| 61 | +#define STM32_SYSCLK_SW RCC_CFGR_SW_HSI |
| 62 | +#define STM32_SYSCLK_SWS RCC_CFGR_SWS_HSI |
| 63 | +#define STM32_SYSCLK_FREQUENCY (STM32_HSI_FREQUENCY) |
| 64 | + |
| 65 | +/* AHB clock (HCLK) is SYSCLK (48 MHz) */ |
| 66 | + |
| 67 | +#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK |
| 68 | +#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY |
| 69 | + |
| 70 | +/* APB1 clock (PCLK) is HCLK (48 MHz) */ |
| 71 | + |
| 72 | +#define STM32_RCC_CFGR_PPRE RCC_CFGR_PPRE_HCLK |
| 73 | +#define STM32_PCLK1_FREQUENCY STM32_HCLK_FREQUENCY |
| 74 | + |
| 75 | +/* LED definitions **********************************************************/ |
| 76 | + |
| 77 | +/* LED index values for use with board_userled() */ |
| 78 | + |
| 79 | +#define BOARD_LED1 0 /* User LD1 */ |
| 80 | +#define BOARD_LED2 1 /* User LD2 */ |
| 81 | +#define BOARD_NLEDS 2 |
| 82 | + |
| 83 | +/* LED bits for use with board_userled_all() */ |
| 84 | + |
| 85 | +#define BOARD_LED1_BIT (1 << BOARD_LED1) |
| 86 | +#define BOARD_LED2_BIT (1 << BOARD_LED2) |
| 87 | + |
| 88 | +/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on the |
| 89 | + * board. The following definitions describe how NuttX controls |
| 90 | + * the LED: |
| 91 | + * |
| 92 | + * SYMBOL Meaning LED1 state |
| 93 | + * ------------------ ----------------------- ---------- |
| 94 | + * LED_STARTED NuttX has been started OFF |
| 95 | + * LED_HEAPALLOCATE Heap has been allocated OFF |
| 96 | + * LED_IRQSENABLED Interrupts enabled OFF |
| 97 | + * LED_STACKCREATED Idle stack created ON |
| 98 | + * LED_INIRQ In an interrupt No change |
| 99 | + * LED_SIGNAL In a signal handler No change |
| 100 | + * LED_ASSERTION An assertion failed No change |
| 101 | + * LED_PANIC The system has crashed Blinking |
| 102 | + * LED_IDLE STM32 is is sleep mode Not used |
| 103 | + */ |
| 104 | + |
| 105 | +#define LED_STARTED 0 |
| 106 | +#define LED_HEAPALLOCATE 0 |
| 107 | +#define LED_IRQSENABLED 0 |
| 108 | +#define LED_STACKCREATED 1 |
| 109 | +#define LED_INIRQ 2 |
| 110 | +#define LED_SIGNAL 2 |
| 111 | +#define LED_ASSERTION 2 |
| 112 | +#define LED_PANIC 1 |
| 113 | + |
| 114 | +/* Button definitions *******************************************************/ |
| 115 | + |
| 116 | +/* Nucleo C092RC board supports two buttons; only one button is controllable |
| 117 | + * by software: |
| 118 | + * |
| 119 | + * B1 USER: user button connected to STM32 I/O PC13. |
| 120 | + * B2 RESET: push button connected to NRST; used to RESET the MCU. |
| 121 | + */ |
| 122 | + |
| 123 | +#define BUTTON_USER 0 /* User B1 */ |
| 124 | +#define NUM_BUTTONS 1 |
| 125 | + |
| 126 | +#define BUTTON_USER_BIT (1 << BUTTON_USER) |
| 127 | + |
| 128 | +/* Alternate function pin selections ****************************************/ |
| 129 | + |
| 130 | +/* USART */ |
| 131 | + |
| 132 | +/* USART1 at arduino D0/D1: |
| 133 | + * USART1_RX - PB6 |
| 134 | + * USART1_TX - PB7 |
| 135 | + */ |
| 136 | + |
| 137 | +#define GPIO_USART1_RX (GPIO_USART2_RX_2|GPIO_SPEED_HIGH) /* PB6 */ |
| 138 | +#define GPIO_USART1_TX (GPIO_USART2_TX_2|GPIO_SPEED_HIGH) /* PB7 */ |
| 139 | + |
| 140 | +/* USART1 RS485_DIR - PA8 (arduino D7) |
| 141 | + * (compatible with RS485 Waveshare shield) |
| 142 | + */ |
| 143 | + |
| 144 | +#define GPIO_USART1_RS485_DIR (GPIO_OUTPUT | GPIO_PUSHPULL | \ |
| 145 | + GPIO_SPEED_HIGH | GPIO_OUTPUT_CLEAR | \ |
| 146 | + GPIO_PORTA | GPIO_PIN8) |
| 147 | + |
| 148 | +/* By default the USART2 is connected to STLINK Virtual COM Port: |
| 149 | + * USART2_RX - PA3 |
| 150 | + * USART2_TX - PA2 |
| 151 | + */ |
| 152 | + |
| 153 | +#define GPIO_USART2_RX (GPIO_USART2_RX_1|GPIO_SPEED_HIGH) /* PA3 */ |
| 154 | +#define GPIO_USART2_TX (GPIO_USART2_TX_1|GPIO_SPEED_HIGH) /* PA2 */ |
| 155 | + |
| 156 | +/* DMA channels *************************************************************/ |
| 157 | + |
| 158 | +/* ADC */ |
| 159 | + |
| 160 | +#define ADC1_DMA_CHAN DMAMAP_DMA1_ADC1 /* DMA1 */ |
| 161 | + |
| 162 | +#endif /* __BOARDS_ARM_STM32F0L0G0_NUCLEO_C092RC_INCLUDE_BOARD_H */ |
0 commit comments