Vista previa parcial del texto
¡Descarga COORDENADAS-ECONOMIA y más Ejercicios en PDF de Economía solo en Docsity!
El Transmisor Receptor Asíncrono Serial Universal (USART) ofrece un medio flexible de intercambio de datos full- duplex con dispositivos externos que requieren un formato de datos serie asíncrono RS-232 estándar de la industria. El USART ofrece una amplia gama de velocidades en baudios utilizando un generador de velocidad en baudios fraccional. Admite comunicación unidireccional síncrona y comunicación de un solo cable semi-dúplex. También soporta las especificaciones LIN (red de interconexión local), Smart Card Protocol, IrDA (asociación de datos infrarrojos) y operaciones de módem (CTS / RTS). Permite la comunicación multiprocesador. La comunicación de datos de alta velocidad es posible utilizando DMA para la configuración de buffers múltiples. El microcontrolador STM32F103Cx tiene 3 módulos USART (USART1, USART2 y USART3). De hecho, puede utilizar cualquiera de ellos para enviar datos seriales a un programa Terminal del computador mediante un convertidor USB- TIL. En la tarjeta Blue Pill se observan los pines PA9, PA10 (TX1, RX1 para el USART1); PA2, PA3 (TX2, RX2 para el USART2); PB10, PB11 (TX3, RX3 para el USART3) 10SC32 IN TAMPER RTC Figura 3.2 Ubicación de los 3 Módulos USART en la tarjeta Blue Pill 2. Crear un nuevo proyecto 'USART_ BluePill' [E 5m4a2 Project la] Betup 57M project E E Project Name: | :5ART_Eluebill Use default locaban Locetion ESA Bro Opticas Torgeted Language DE Ote Targeted Binary Type 2 Enecuteble (| Static Library Targeted Project Type 3 5TMI2Cube )Empty 3. Enla categoría Connectivity, seleccionar USART1. En Modo, elegir Asíncrono. Verificar, en los parámetros: Tasa de Baus = 115200, Word Length=8, Paridad: ninguna; y Bits de parada=1 [ue] UN_MII - Device Configuration Tool - STM32CubelDE - [m] x File Edit Mavigate Search Project Run Wendow Help S-06/8-4- 5d :+-0-4 pr breo+ola la S 0 [USAR Bluebilios E USARTI Mode and Configuration E Pinoutwiew DA Into Ea — TM US Led Elink: ÚS LED WDG System Care > Made ¡Asynciranous «e DD LED PARPe Hardware Flow Control (AS232) [Disable + 1 Ledine Analog > 1D Ledimpro: ES Lena Timers > «we [E] USART_ Bla > include | Commectivin v al Corfiguratio: > ES Core y Resel Configuration > 3D se ria y STM3ZF IN SS E usarr 1301 LI UVTimerte El ÓN VEL_LED_B usario] [Configure the below parameters LISARTZ a 0 0 o 10 y Basic Paramelers De Baud Rate 116200 Bita/s . , LB Viord Length 0 Bits (including Parity) Computing — Party None ml Stop Bits 1 Middlemare : v Advanced Parameters Data Direction Receive and Transmit ra 2) . e qa 0. e la dd 5. Enla pestaña de Configuración del Reloj, establecer el valor del Reloj de Sistema a 72 MHz [EE ur > Device Configuration Tool SIMEZCS2eDE =D Xx Fle Est Mavgate Ses Projez Fun Windon Pep +e->-10118 m1 mas lnsues 1 Uvlimerem DO ven LED Bu 6. Enla categoría System Core, seleccionar 5YS. En Modo, configurar Debug a “Serial Wire” [E Uv MN - Device Configuration Toci - STMS¿CubelDE -= 0 x Fle Edit Mawigate Search Project Run Window Help 0-6 Ad OA ->-[m10 PE =D [EP USART BluePilldoc 52 ag UU ADC_LDR, Y ADC_LOR. UU Interrupci 0% ÚS InEXxT_Bho 55 Mode and Configuration a v] A 15 Led Blink ñ : IN LEO MWOC | SystemCor Y Debug Serial Wire w] LED E El J 1 LED_PORP: a O System Wake-Up Ús Ledint DMA. Timabase Source [SysTick w ra IWDG se [E USART_ 8h e y pl trade e 28 tor A e AcG_0_DUr y ST Warning: This 1P has no parameters to be configu! E usar, UU Uv Tener n STMIIF10306 Ya vel iento Analog : LOFP4R Timers > Idol alelslelelalals! Comectidty > Computing > Middleware > 9. Escribir el código de la aplicación. Declaración de variables: 68 /* USER CODE BEGIN 1 */ 69 uint8_t MSG[35] = ('10'); //Vector para el mensaje ASCII a ser transmitido 70 uint8_t X = 0; //Variable tipo byte a ser monitoreada 71 /* USER CODE END 1 */ Bucle infinito: 97 /* USER CODE BEGIN WHILE */ 98 while (1) 9 4 es /* USER CODE END WHILE */ 101 e2 /” USER CODE BEGIN 3 */ 03 sprintf(MSG, "Variable X = Xdirin", X); 104 HAL_UART_Transmit(8huart1, MSG, sizeof(MSG), 100); 105 HAL_Delay(500); 106 Xt; e7 108 /* USER CODE END 3 */ 10. Compilar el programa 4 y verificar que no existan errores de sintaxis. 11. Conectando el Grabador/Depurador ST-LINK V2, grabar el código en la tarjeta Blue Pill 12. Conectar el Conversor USB-TTL al computador y comprobar, en el Administrador de Dispositivos, la asignación del número COM virtual que asignará Windows (Ejemplo. COM6). Luego cerrar la ventana y desconectar el Conversor USB-TTL. A Administrador de dispositivos - a] Xx Archivo Acción Ver Ayuda €s (mm Bm] a UN Adaptadores de pantalla A > ES Adaptadores de red > ( Bluetooth > 3 Colas de impresión *% Controladoras ATA/ATAPI IDE fin Controladoras de almacenamiento » 4) Controladoras de bus serie universal > [A Dispositivos de interfaz de usuario (HID) Ki Dispositivos de juego, sonido y video ) fl Dispositivos de software , Dispositivos del sistema > BM Dispositivos portátiles > $) Eltima Usb Stub > U Entradas y salidas de audio EE Equipo Firmware > E Monitores > (M Mouse y otros dispositivos señaladores » E Procesadores vw Puertos (COM y LPT) ñ Communications Port (COM1) A USB Serial Port (COME) EZ Teclados e Unidades de disco > dá Unidades de DVD o CD-ROM 14. Desde el menú principal, seleccionar “Window — Show View — Console” para abrir la ventana de Consola - O x New Window ¡PUES IA A il] [Queracces ]:| 8 10 + A a! (0 Bota Tergets 52 30, aer ines» E H z Perspective 0 [E USART_Bruepal /* USER COD S 1% (/C=+ Projects /” USER COD sorimtrcss Preferences “2 include Browser Y lOPortsProteus 104 HAL_UART Transeit(fhuartl, MSG, $ e 1 Led Blink 105 MAL_Delay(508); Navigstor (Deprecated) ÓN LED_WOG pad Ne EE Cutie AR=Shift+Q, O KZ LED_PARPADEO 208 — )* USEN- CODE 03 E Problem Details La Ledira 2... [E Problems Añ=Shift=Q, X po EOS POrES y > . y Project Explorer VE USAR Stvepin ¡El Problems E) Task ED Console 23 [7] Properties 17] propenies as $58 -=0 > 4 Binaries MR Y sen Añ=Shit+Q, $ E DAS > ) Includes USART_ BluePill Debug [STM32 Cortex-M C/ sg ss search results available. Start a > 8 Core d ma zh from the search dislog.. > 69 Drivers Rea > 5 Debug Menory ¡ram » Ls STMGLFIO3CETXFLASH. Id Opening and parsing file: ST-LIMK_GDS_serve Other... AR=Shát»Q Q lÉ USART_Bluebill Debugaunc) File : ST-LINK_G08_server_009620. 20 ue Bluel >. Size : 8063 Bytes pr] UVTimerTe de Address : 0xB3000IOS. UD VELLEO_BUNK Erasing menory corresponding to segment O: Erasing internal memory sectors [0 7] Download in Progress: File domnload complete Y < EE > 4 O rs > 15. En la ventana Console, hacer click en “Open Console” y seleccionar la opción “3 Command Shell Console” [El uv ma - USART_BluePilUCore/Src/main.c - STMI2CubelDE - 0 E File Edt Source Refactor Navigate Search Project Run Víúndow Help TS A IAEA ACACIA De DA A De A MIA Ly Project Explorer 53 =p [usa sue [á maine DR? 0 lea) LS ADC_LOR Eluepill ss 4 ÚD ADC_LOR Proteus 13 intermapcionxtemaBluePill * USER CODE END 6 * USER CODE E de 13 imtExT_Bluepa sprintf(MSG, "Variable Xx = Xdirin”, X); (3 ¡OPortsProteus HAL_VART_Trensmit(Bhuartl, MSG, sizeof(MS6), 100); 13 Led Blink HAL_Delay(500); 1D LEDIWDG ) 204% id * USER CO END 3 * 3001 LS LedintPROTEUS = : Xx p ” a us se [5] Problems E) Tests E) Console 53 [1] Properties s a Pr ES [=] » $$ Binanies nx io 00 o- > ny- mv > E incudes USART_BluePil Debug [STM32 Cortex-M C/C== Application] ST-LINK (ST-UN E) y New Console View 3 Core Status Refresh Delay 5 155 50 Verbose Mode : Disabled 2.C/C=-» Build Console De SHO Debug : Enabled e Du Inituhile : Enabled 9 STM22F103C6TX_FLASH Id E 4Device Confsgurstion Tool Console , USART_BruePill Debug.leun STMAZACUREIDE =D ox fe E0t Soce Befoctor Mage Sesrh Pmopect Pan Mindo eo 2 S-4-Aiviaid-8-E-0-1H-0-- 84 1S P-E->So-S-418 Qui acces) 08 [BID 4 PA E] a ula ages o SO BR a ¿ea lp de (ED OC _LOR Buen [E UsAAT a OCIO res + USER C0OE END MILE 1 Imagenes 4% USER CODE MEGA 1 7 aprimt($66, "Variable X= Adel, Ka HALUART TeansmitíAhuartl, MSS, «izeof(MSG), 180); apela (500); e 1 ImioT_Diora J 7 sen caos ena + ZE Pretams El Tak ED comioie 03 CO Properties USB-TTL (COMMECTED) Varisble X Versasta Debog a STMBESIDICODUFLASH Id El USAR Euuerin Deng. lsunel [»-] Dl UvTmertemponzador VELO, SU tO Xx x 0649 60-44 D56-20 + +49990 90 ¿Do TAM 24687 BE MNABxXOO (A Home Page E Sehematic Capture E Edi Comp Ji Ear Component ? x Pat Pieterenica: I Hidder: [TJ Part Velue: Hidden: [] INSTRUMENTS OSCILLOSCOPE Baud Rate. 115200 Hide Al Data Bes: a Hide Al Ai [ue] Y el E dE A 4 TXD SP] DEBUGGE) Patty NONE Hide Al Ye [na ñ Sog Bla 1 Hide Al RTS Send XON/XDFF Ho se || His A Advanced Properties RATA Polarty Nomal Hide Al CTS WATTMETER Lts Eropértiva O Attaci hierarciyy module: [Edit al properties am best *B6>80003 ¡4 81