STM32F는 이렇게 단순한데
검색한 내용중에 H와 G 시리즈가 걸려 나와서
STM32G로 검색해서 가장 위에 있던 STM32G030C6Tx로
프로젝트 구성해보니 내용이 많이 나온다. 눈에 띄는건.. MSB First 라는 항목
main.c는 아래와 같이 생성되었고
/* USER CODE END USART1_Init 1 */ huart1.Instance = USART1; huart1.Init.BaudRate = 115200; huart1.Init.WordLength = UART_WORDLENGTH_8B; huart1.Init.StopBits = UART_STOPBITS_1; huart1.Init.Parity = UART_PARITY_NONE; huart1.Init.Mode = UART_MODE_TX_RX; huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart1.Init.OverSampling = UART_OVERSAMPLING_16; huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1; huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_DMADISABLEONERROR_INIT|UART_ADVFEATURE_MSBFIRST_INIT; huart1.AdvancedInit.DMADisableonRxError = UART_ADVFEATURE_DMA_DISABLEONRXERROR; huart1.AdvancedInit.MSBFirst = UART_ADVFEATURE_MSBFIRST_ENABLE; |
Stm32g0xx_hal_uart.h를 따라가면 아래와 같이 먼가 있긴 하다.(귀찮아..)
#define UART_ADVFEATURE_NO_INIT 0x00000000U /*!< No advanced feature initialization */ #define UART_ADVFEATURE_TXINVERT_INIT 0x00000001U /*!< TX pin active level inversion */ #define UART_ADVFEATURE_RXINVERT_INIT 0x00000002U /*!< RX pin active level inversion */ #define UART_ADVFEATURE_DATAINVERT_INIT 0x00000004U /*!< Binary data inversion */ #define UART_ADVFEATURE_SWAP_INIT 0x00000008U /*!< TX/RX pins swap */ #define UART_ADVFEATURE_RXOVERRUNDISABLE_INIT 0x00000010U /*!< RX overrun disable */ #define UART_ADVFEATURE_DMADISABLEONERROR_INIT 0x00000020U /*!< DMA disable on Reception Error */ #define UART_ADVFEATURE_AUTOBAUDRATE_INIT 0x00000040U /*!< Auto Baud rate detection initialization */ #define UART_ADVFEATURE_MSBFIRST_INIT 0x00000080U /*!< Most significant bit sent/received first */ #define USART_CR2_MSBFIRST_Pos (19U) #define USART_CR2_MSBFIRST_Msk (0x1UL << USART_CR2_MSBFIRST_Pos) /*!< 0x00080000 */ #define USART_CR2_MSBFIRST USART_CR2_MSBFIRST_Msk /*!< Most Significant Bit First */ #define UART_ADVFEATURE_MSBFIRST_DISABLE 0x00000000U /*!< Most significant bit sent/received first disable */ #define UART_ADVFEATURE_MSBFIRST_ENABLE USART_CR2_MSBFIRST /*!< Most significant bit sent/received first enable */ |
The USART can also communicate synchronously. It can operate as a SPI in Master or Slave mode with programmable clock polarity (CPOL) and phase (CPHA) and programmable data order with MSB or LSB first. The clock is output (in case of Master mode) or input (in case of Slave mode) on the CK pin. No clock pulses are provided during the start and stop bits. When the USART is configured in SPI slave mode, it supports the Transmit underrun error and the NSS hardware or software management. |
[링크 : https://www.st.com/.../en.STM32G0-Peripheral-USART-interface-USART.pdf]
[링크 : https://www.st.com/.../en.STM32H7-Peripheral-USART_interface_USART.pdf]
'embeded > Cortex-M3 STM' 카테고리의 다른 글
stm32 tim output compare(OC) mode (0) | 2024.07.12 |
---|---|
stm32 reset 없이 JTAG 붙이기 (0) | 2023.07.19 |
stm32 wdg 최대 설정시간 (0) | 2021.08.09 |
stm32 RST pull-up reset fail (0) | 2021.08.02 |
STM32 RDP(ReaD Protection) (0) | 2021.07.02 |