久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: stm32l053r8t6的串口收發送例程分析源碼下載 [打印本頁]

作者: heila    時間: 2015-12-9 01:17
標題: stm32l053r8t6的串口收發送例程分析源碼下載
  關于stm32l0 nucleo開發板上串口的例程只給了三個例程,這三個例程名字文件如下
        UART_TwoBoards_ComDMA,UART_TwoBoards_ComIT,UART_TwoBoards_ComPolling
        大概就是第一個利用DMA進行發送接收的,第二個就是中斷發送接收的,第三個就是用輪訓的方式實現的,由于三個例程的并沒有完全投入大部分精力去搞,所以說明顯得很淺顯,如果之前用過stm32f103系列的,那么這點淺顯的提示也可以提供一定的提示的,在這里我用了類似stm32f103的經常用的串口方式,就是串口發送不用中斷,中斷接收模式。
        官方例程原文
        @par Example Description 例程描述

This Example shows a UART transmission (transmit/receive) between 2
STM32L053R8-Nucleo boards in interrupt mode.這個例子展示了串口的中斷收發模式。

At the beginning of the main program the HAL_Init() function is called to reset
all the peripherals, initialize the Flash interface and the systick.
Then the SystemClock_Config() function is used to configure the system
clock (SYSCLK) to run at 32 MHz.
        一開始的主程序通過這個函數來復位所有外設,初始化flash系統滴答接口,為了滴答用可能跟flash有關。

Then 1st board is waiting for user button key to be pressed. Once done, data
are transmitted through uart2 in IT mode. 2nd board has configured Uart2
to receive data in IT mode. Once data received is completed, 2nd board also
transmit same characters on uart1 which will be received by 1st board.
Both boards compare transmitted data to received ones. If they are same, green
led2 is turn on, else led2 is turn Off.
第一塊板子等待按鍵按下后,數據發送給第二個板子,這里是IT模式,第二塊板子通過串口中斷接收到數據后,再將該數據發送給第一塊板子。如果數據
        一樣綠燈亮。
       
Warning: As both boards do not behave same way, "TRANSMITTER_BOARD" switch
compilation exists to determine either software is for 1st transmitter board or
2nd receiver (then transmitter) board. In other words, 1st board has to be
flashed with software compiled with switch enable, 2nd board has to be flashed
with software compiled with switch disable.

LED2 can be used to monitor the transfer status:
- LED2 turns ON on master board waiting user button to be pressed.
- LED2 turns OFF on master board waiting the transmission process is complete.
- LED2 turns ON when the transmission/reception process is correct.   

The UART is configured as follow:
    - BaudRate = 9600 baud  
    - Word Length = 8 Bits (7 data bit + 1 parity bit)
    - One Stop Bit
    - None parity
    - Hardware flow control disabled (RTS and CTS signals)
    - Reception and transmission are enabled in the time

@note USARTx/UARTx instance used and associated resources can be updated in "main.h"
file depending hardware configuration used.

@note When the parity is enabled, the computed parity is inserted at the MSB
position of the transmitted data.

@note Care must be taken when using HAL_Delay(), this function provides accurate
      delay (in milliseconds) based on variable incremented in SysTick ISR. This
      implies that if HAL_Delay() is called from a peripheral ISR process, then
      the SysTick interrupt must have higher priority (numerically lower)
      than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
      To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
      
@note The application need to ensure that the SysTick time base is always set to 1 millisecond
      to have correct HAL operation.

@par Directory contents

  - UART/UART_TwoBoards_ComIT/Inc/stm32l0xx_hal_conf.h    HAL configuration file
  - UART/UART_TwoBoards_ComIT/Inc/stm32l0xx_it.h          IT interrupt handlers header file
  - UART/UART_TwoBoards_ComIT/Inc/main.h                  Header for main.c module  
  - UART/UART_TwoBoards_ComIT/Src/stm32l0xx_it.c          IT interrupt handlers
  - UART/UART_TwoBoards_ComIT/Src/main.c                  Main program
  - UART/UART_TwoBoards_ComIT/Src/stm32l0xx_hal_msp.c     HAL MSP module
  - UART/UART_TwoBoards_ComIT/Src/system_stm32l0xx.c      STM32L0xx system source file


@par Hardware and Software environment

  - This example runs on STM32L051xx, STM32L052xx, STM32L053xx STM32L062xx and
    STM32L063xx device lines RevZ
   
  - This example has been tested with STM32L053R8-Nucleo RevC and can be
    easily tailored to any other supported device and development board.

  - STM32L053R8-Nucleo RevC Set-up
    - Connect a wire between 1st board PA9 (pin 21 in CN10 connector) pin (Uart Tx)
      to 2nd board PA10 (pin 33 in CN10 connector) pin (Uart Rx)
    - Connect a wire between 1st board PA10 (pin 33 in CN10 connector) pin (Uart Rx)
      to 2nd board PA9 (pin 21 in CN10 connector) pin (Uart Tx)

  
@par How to use it ?

In order to make the program work, you must do the following :
- Open your preferred toolchain
- Rebuild all files and load your image into target memory
- Run the example
      
* <h3><center>&copy; COPYRIGHT STMicroelectronics</center></h3>
*/
實際上用官方的例程對于我這個用慣了stm32f103的庫函數的人來說,感覺很別扭,stm32l0的庫函數使用HAL 庫函數的很麻煩。
        在自己的配置中
        要將這個函數放到main循環中。
        HAL_UART_Receive_IT(&UartHandle, (uint8_t *)aRxBuffer1, 10);

stm32cubel0.zip:下載地址 鏈接:http://pan.baidu.com/s/1mhbXTcG 密碼:4p9x

作者: newheyuan    時間: 2017-3-16 10:47
感謝樓主好文




歡迎光臨 (http://m.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 亚洲视频一区二区 | av网页在线观看 | 在线国产小视频 | 日韩在线欧美 | 亚洲精品久久久久久久久 | 亚洲一区二区精品视频 | 中文字幕在线免费观看视频 | av在线播放网站 | 国产一级片在线播放 | 伊人av综合 | 波多野结衣一区二区三区在线观看 | 成人激情综合网 | 国产精品福利在线 | 精品国产一区二 | 美女免费网站 | 成人精品免费视频 | 欧美a一级 | 亚洲欧美一区二区三区四区 | 亚洲国产黄色 | 日韩一区二区三区视频 | 天天干天天干天天操 | 中文在线视频 | 亚洲国产成人av | 国产理论视频 | 日韩免费在线视频 | 欧美日韩精品 | 中文字幕日韩视频 | 国产日韩久久 | 福利视频午夜 | 91爱爱爱| 五月天婷婷社区 | 91爱视频| 一区二区高清视频 | 久久久成人精品 | 91精品网 | 一区二区网站 | 日韩精品视频免费播放 | 五月婷婷综合激情 | 亚洲午夜精品一区二区三区 | 91在线精品秘密一区二区 | 国产成人精品一区二区三区四区 |