MSP学习笔记初识开发板和IDE
STM32F20xxx_21xxx单片机硬件开发入门笔记

STM32F20xxx_21xxx单⽚机硬件开发⼊门笔记AN3320Application noteGetting started with STM32F20xxx/21xxx MCUhardware developmentIntroductionThis application note is intended for system designers who require a hardwareimplementation overview of the development board features such as the power supply, theclock management, the reset control, the boot mode settings and the debug management. It shows how to use the high-density performance line STM32F20xxx/21xxx product familiesand describes the minimum hardware resources required to develop anSTM32F20xxx/21xxx application.Detailed reference design schematics are also contained in this document with descriptionsof the main components, interfaces and modes.August 2011Doc ID 18267 Rev 21/29/doc/20ec15b314791711cd7917a6.htmlContents AN3320Contents1Power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.1.1Independent A/D converter supply and reference voltage . . . . . . . . . . . . 71.1.2Battery backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.1.3Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2Power supply schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3Reset & power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.3.1Power on reset (POR) / power down reset (PDR) . . . . . . . . . . . . . . . . . . 91.3.2Programmable voltage detector (PVD) . . . . . . . . . . . . . . . . . . . . . . . . . 101.3.3System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.1HSE OSC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.1.1External source (HSE bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.1.2External crystal/ceramic resonator (HSE crystal) . . . . . . . . . . . . . . . . . 132.2LSE OSC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.2.1External source (LSE bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.2.2External crystal/ceramic resonator (LSE crystal) . . . . . . . . . . . . . . . . . . 142.3Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.1Boot mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.2Boot pin connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3Embedded boot loader mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174Debug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.2SWJ debug port (serial wire and JTAG) . . . . . . . . . . . . . . . . . . . . . . . . . . 184.3Pinout and debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.3.1SWJ debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.3.2Flexible SWJ-DP pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.3.3Internal pull-up and pull-down resistors on JT AG pins . . . . . . . . . . . . . . 194.3.4SWJ debug port connection with standard JTAG connector . . . . . . . . . 20 2/29 Doc ID 18267 Rev 2AN3320Contents5Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.1Printed circuit board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.2Component position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.3Ground and power supply (V SS, V DD) . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.4Decoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.5Other signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225.6Unused I/Os and features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226Reference design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.1Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.1.1Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.1.2Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.1.3Boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.1.4SWJ interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.1.5Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.2Component references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 7Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Doc ID 18267 Rev 23/29List of tables AN3320 List of tablesTable 1.Boot modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Table 2.Debug port pin assignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Table 3.SWJ I/O pin availability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Table 4.Mandatory components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Table 5.Optional components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Table 6.Reference connection for all packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Table 7.Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4/29 Doc ID 18267 Rev 2AN3320List of figures List of figuresFigure 1.Power supply overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Figure 2.Power supply scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Figure 3.Power-on reset/power-down reset waveform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Figure 4.PVD thresholds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Figure 5.Reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Figure 6.HSE external clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Figure 7.HSE crystal/ceramic resonators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Figure 8.LSE external clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Figure 9.LSE crystal/ceramic resonators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Figure 10.Boot mode selection implementation example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Figure 11.Host-to-board connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Figure 12.JTAG connector implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Figure 13.Typical layout for V DD/V SS pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Figure 14.STM32F207IG(H6) microcontroller reference schematic. . . . . . . . . . . . . . . . . . . . . . . . . . 25Doc ID 18267 Rev 25/29Power supplies AN33206/29 Doc ID 18267 Rev 21 Power supplies1.1 IntroductionThe device requires a 1.8V to 3.6V operating voltage supply (V DD ), excepted the WLCSPpackage witch requires 1.65V to 3.6V. An embedded regulator is used to supply the internal 1.2V digital power.The real-time clock (RTC) and backup registers can be powered from the V BAT voltage when the main V DD supply is powered off.1.V DDA and V SSA must be connected to V DD and V SS , respectively.2.The voltage on V REF ranges from 1.65V to V DDA for WLCSP64+2 packages.AN3320Power suppliesDoc ID 18267 Rev 27/291.1.1 Independent A/D converter supply and reference voltageTo improve conversion accuracy, the ADC has an independent power supply that can be filtered separately, and shielded from noise on the PCB.●the ADC voltage supply input is available on a separate V DDA pin ●an isolated supply ground connection is provided on the V SSA pinWhen available (depending on package), V REF– must be tied to V SSA .On 100-pin package and above and on WLCSP64+2To ensure a better accuracy on low-voltage inputs, the user can connect a separate external reference voltage ADC input on V REF+. The voltage on V REF+ may range from 1.8V to V DDA . On WLCSP64+2, the V REF- pin is not available, it is internally connected to the ADC ground (V SSA ).On 64-pin packagesThe V REF+ and V REF- pins are not available, they are internally connected to the ADC voltage supply (V DDA ) and ground (V SSA ).1.1.2 Battery backupTo retain the content of the Backup registers when V DD is turned off, the V BAT pin can beconnected to an optional standby voltage supplied by a battery or another source.The V BAT pin also powers the RTC unit, allowing the RTC to operate even when the main digital supply (V DD ) is turned off. The switch to the V BAT supply is controlled by the power down reset (PDR) circuitry embedded in the Reset block.If no external battery is used in the application, it is highly recommended to connect V BAT externally to V DD .1.1.3 Voltage regulatorThe voltage regulator is always enabled after reset. It works in three different modesdepending on the application modes.●in Run mode, the regulator supplies full power to the 1.2V domain (core, memories and digital peripherals)●in Stop mode, the regulator supplies low power to the 1.2V domain, preserving the contents of the registers and SRAM●in Standby mode, the regulator is powered down. The contents of the registers and SRAM are lost except for those concerned with the Standby circuitry and the Backup domain.Note:Depending on the selected package, there are specific pins that should be connected either to V SS or V DD to activate or deactivate the voltage regulator. Refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet for details .Power supplies AN33208/29 Doc ID 18267 Rev 21.2 Power supply schemesThe circuit is powered by a stabilized power supply, V DD .●Caution:–The V DD voltage range is 1.8V to 3.6V (and 1.65V to 3.6V for WLCSP64+2 package)●The V DD pins must be connected to V DD with external decoupling capacitors: one single T antalum or Ceramic capacitor (min. 4.7µF typ.10µF) for the package + one 100nF Ceramic capacitor for each V DD pin.●The V BAT pin can be connected to the external battery (1.65V < V BA T < 3.6V). If no external battery is used, it is recommended to connect this pin to V DD with a 100nF external ceramic decoupling capacitor.●The V DDA pin must be connected to two external decoupling capacitors (100nF Ceramic + 1µF Tantalum or Ceramic).●The V REF+ pin can be connected to the V DDA external power supply. If a separate, external reference voltage is applied on V REF+, a 100nF and a 1µF capacitors must be connected on this pin. In all cases, V REF+ must be kept between 1.65V and V DDA .●Additional precautions can be taken to filter analog noise:–V DDA can be connected to V DD through a ferrite bead.–The V REF+ pin can be connected to V DDA through a resistor (typ. 47Ω).●For the voltage regulator configuration, there are specific pins (REGOFF and IRROFF depending on the package) that should be connected either to VSS or VDD to activate or deactivate the voltage regulator specific. Refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet for details .●When the voltage regulator is enabled, V CAP1 and V CAP2 pins must be connected to 2*2.2µF Ceramic capacitor.AN3320Power suppliesDoc ID 18267 Rev 29/291.Optional. If a separate, external reference voltage is connected on V REF+, the two capacitors (100 nF and1µF) must be connected.2.V REF + is either connected to V REF or to V DDA .3.N is the number of V DD and V SS inputs.4.Refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet to connect REGOFF and IRROFFpins.1.3Reset & power supply supervisor1.3.1Power on reset (POR) / power down reset (PDR)The device has an integrated POR/PDR circuitry that allows proper operation starting from 1.8V .The device remains in the Reset mode as long as V DD is below a specified threshold, V POR/PDR , without the need for an external reset circuit. For more details concerning the power on/power down reset threshold, refer to the electrical characteristics in STM32F20xxx/21xxx datasheets.On WLCSP66 package if IRROFF pin is set to V DD (in that case REGOFF pin must not be activated, refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet for details ), the PDR is not functional. Then the V DD can lower below 1.8V , but the external circuitry must ensure that reset pin is activated when V DD /V DDA becomes below 1.65V .Power suppliesAN332010/29 Doc ID 18267 Rev 21.t RSTTEMPO is approximately2.6ms. V POR/PDR rising edge is 1.74V (typ.) and V POR/PDR falling edge is1.70V (typ.). Refer to STM32F20xxx/21xxx datasheets for actual value.1.3.2 Programmable voltage detector (PVD)Y ou can use the PVD to monitor the V DD power supply by comparing it to a thresholdselected by the PLS[2:0] bits in the Power control register (PWR_CR).The PVD is enabled by setting the PVDE bit.A PVDO flag is available, in the Power control/status register (PWR_CSR), to indicatewhether V DD is higher or lower than the PVD threshold. This event is internally connected to EXTI Line16 and can generatean interrupt if enabled through the EXTI registers. The PVD output interrupt can be generated when V DD drops below the PVD threshold and/or when VDD rises above the PVD threshold depending on the EXTI Line16 rising/falling edge configuration. As an example the service routine can perform emergency shutdown tasks.AN3320Power suppliesDoc ID 18267 Rev 211/291.3.3 System resetA system reset sets all registers to their reset values except for the reset flags in the clockcontroller CSR register and the registers in the Backup domain (see Figure 1).A system reset is generated when one of the following events occurs:1. A low level on the NRST pin (external reset)2. window watchdog end-of-count condition (WWDG reset)3. Independent watchdog end-of-count condition (IWDG reset)4. A software reset (SW reset)5.Low-power management resetThe reset source can be identified by checking the reset flags in the Control/Status register, RCC_CSR.The STM32F20xxx/21xxx does not require an external reset circuit to power-up correctly. Only a pull-down capacitor is recommended to improve EMS performance by protecting the device against parasitic resets. See Figure 5.Charging and discharging a pull-down capacitor through an internal resistor increases the device power consumption. The capacitor recommended value (100nF) can be reduced to 10nF to limit this power consumption;Clocks AN332012/29 Doc ID 18267 Rev 22 ClocksThree different clock sources can be used to drive the system clock (SYSCLK):●HSI oscillator clock (high-speed internal clock signal)●HSE oscillator clock (high-speed external clock signal)●PLL clockThe devices have two secondary clock sources:●32kHz low-speed internal RC (LSI RC) that drives the independent watchdog and, optionally, the RTC used for Auto-wakeup from the Stop/Standby modes.●32.768kHz low-speed external crystal (LSE crystal) that optionally drives the real-time clock (RTCCLK)Each clock source can be switched on or off independently when it is not used, to optimize the power consumption.Refer to the STM32F20xxx/21xxx reference manual RM0033 for the description of the clock tree.2.1 HSE OSC clockThe high-speed external clock signal (HSE) can be generated from two possible clock sources:●HSE external crystal/ceramic resonator (see Figure 7)●HSE user external clock (see Figure 6)1.The value of R EXT depends on the crystal characteristics. Typical value is in the range of 5 to 6 R S(resonator series resistance).2.Load capacitance C L has the following formula: C L = C L1 x C L2 / (C L1 + C L2) + C stray where: C stray is the pincapacitance and board or trace PCB-related capacitance. Typically, it is between 2pF and 7pF. Please refer to Section 5: Recommendations on page 21 to minimize its value.Figure 6.HSE external clockFigure 7.HSE crystal/ceramicAN3320ClocksDoc ID 18267 Rev 213/292.1.1 External source (HSE bypass)In this mode, an external clock source must be provided. It can have a frequency from 1 to 16MHz (refer toSTM32F20xxx/21xxx datasheets for actual max value).The external clock signal (square, sine or triangle) with a duty cycle of about 50%, has to drive the OSC_IN pin while the OSC_OUT pin must be left in the high impedance state (see Figure 7 and Figure 6).2.1.2 External crystal/ceramic resonator (HSE crystal)The external oscillator frequency ranges from 4 to 26MHz.The external oscillator has the advantage of producing a very accurate rate on the mainclock. The associated hardware configuration is shown in Figure 7. Using a 25MHz oscillator frequency is a good choice to get accurate Ethernet, USB OTG high-speed peripheral, and I 2S.The resonator and the load capacitors have to be connected as close as possible to the oscillator pins in order to minimize output distortion and startup stabilization time. The load capacitance values must be adjusted according to the selected oscillator.For C L1 and C L2 it is recommended to use high-quality ceramic capacitors in the 5pF-to-25pF range (typ.), designed for high-frequency applications and selected to meet the requirements of the crystal or resonator. C L1 and C L2, are usually the same value. Thecrystal manufacturer typically specifies a load capacitance that is the series combination of C L1 and C L2. The PCB andMCU pin capacitances must be included when sizing C L1 and C L2 (10 pF can be used as a rough estimate of the combined pin and board capacitance).Refer to the electrical characteristics sections in the datasheet of your product for more details.Clocks AN332014/29 Doc ID 18267 Rev 22.2 LSE OSC clockThe low-speed external clock signal (LSE) can be generated from two possible clocksources:●LSE external crystal/ceramic resonator (see Figure 9)●LSE user external clock (see Figure 8)1.“LSE crystal/ceramic resonators” figure:To avoid exceeding the maximum value of C L1 and C L2 (15pF) it is strongly recommended to use a resonator with a load capacitance C L ≤7pF. Never use a resonator with a load capacitance of 12.5pF.2.“LSE external clock” and “LSEcrystal/ceramic resonators” figures:OSC32_IN and OSC32_OUT pins can be used also as GPIO, but it is recommended not to use them as both RTC and GPIO pins in the same application.3.“LSE crystal/ceramic resonators” figure:The value of R EXT depends on the crystal characteristics. A 0Ω resistor would work but would not be optimal. To fine tube R S value, refer to AN2867 - Oscillator design guide for ST microcontrollers.2.2.1 External source (LSE bypass)In this mode, an external clock source must be provided. It can have a frequency of up to 1MHz. The external clock signal (square, sine or triangle) with a duty cycle of about 50% has to drive the OSC32_IN pin while the OSC32_OUT pin must be left high impedance (see Figure 8).2.2.2 External crystal/ceramic resonator (LSE crystal)The LSE crystal is a 32.768kHz low-speed external crystal or ceramic resonator. It has theadvantage of providing a low-power, but highly accurate clock source to the real-time clock peripheral (RTC) forclock/calendar or other timing functions.The resonator and the load capacitors have to be connected as close as possible to the oscillator pins in order to minimize output distortion and startup stabilization time. The load capacitance values must be adjusted according to the selected oscillator.Figure 8.LSE external clockFigure 9.LSE crystal/ceramicAN3320ClocksDoc ID 18267 Rev 215/292.3 Clock security system (CSS)The clock security system can be activated by software. In this case, the clock detector is enabled after the HSE oscillator startup delay, and disabled when this oscillator is stopped.●If a failure is detected on the HSE oscillator clock, the oscillator is automaticallydisabled. A clock failure event is sent to the break input of the TIM1 advanced control timer and an interrupt is generated to inform the software about the failure (clocksecurity system interrupt CSSI), allowing the MCU to perform rescue operations. The CSSI is linked to the Cortex?-M3 NMI (non-maskable interrupt) exception vector.●If the HSE oscillator is used directly or indirectly as the system clock (indirectly means that it is used as the PLL input clock, and the PLL clock is used as the system clock), a detected failure causes a switch of the system clock to the HSI oscillator and thedisabling of the external HSE oscillator. If the HSE oscillator clock (divided or not) is the clock entry of the PLL used as system clock when the failure occurs, the PLL is disabled too.For details, see the STM32F20xxx/21xxx (RM0033) reference manuals available from the STMicroelectronics website /doc/20ec15b314791711cd7917a6.html .Boot configuration AN332016/29 Doc ID 18267 Rev 23 Boot configuration3.1 Boot mode selectionIn the STM32F20xxx/21xxx, three different boot modes can be selected by means of theBOOT[1:0] pins as shown in Table 1.The values on the BOOT pins are latched on the 4th rising edge of SYSCLK after a reset. It is up to the user to set the BOOT1 and BOOT0 pins after reset to select the required boot mode.The BOOT pins are also resampled when exiting the Standby mode. Consequently, they must be kept in the required Boot mode configuration in the Standby mode. After this startup delay has elapsed, the CPU fetches the top-of-stack value from address 0x0000 0000, and starts code execution from the boot memory starting from 0x0000 0004.3.2 Boot pin connectionFigure 10 shows the external connection required to select the boot memory of the STM32F20xxx/21xxx.1.Resistor values are given only as a typical example.Table 1.Boot modesBOOT mode selection pinsBoot mode AliasingBOOT1BOOT0x 0Main Flash memory Main Flash memory is selected as boot space01System memory System memory is selected as boot space11Embedded SRAMEmbedded SRAM is selected as boot spaceAN3320Boot configuration3.3 Embedded boot loader modeThe Embedded boot loader mode is used to reprogram the Flash memory using one of theavailable serial USART1(PA9/PA10), USART3(PB10/11 & PC10/11), CAN2(PB5/13) or USBOTG FS(PA11/12) in Device mode (DFU: device firmware upgrade).The USART peripheral operates with the internal 16MHz oscillator (HSI). The CAN andUSB OTG FS, however, can only function if an external clock (HSE) multiple of 1 MHz(between 4 and 26 MHz)is present.This embedded boot loader is located in the System memory and is programmed by STduring production.For additional information, refer to AN2606.Doc ID 18267 Rev 217/29Debug management AN332018/29 Doc ID 18267 Rev 24 Debug management4.1 IntroductionThe Host/Target interface is the hardware equipment that connects the host to theapplication board. This interface is made of three components: a hardware debug tool, a JTAG or SW connector and a cable connecting the host to the debug tool.Figure 11 shows the connection of the host to the evaluation board STM3220G-EVAL.Figure 11.Host-to-board connection 4.2 SWJ debug port (serial wire and JTAG)The STM32F20xxx/21xxx core integrates the serial wire / JT AG debug port (SWJ-DP). It is an ARM? standard CoreSight? debug port that combines a JTAG-DP (5-pin) interface and a SW-DP (2-pin) interface.●The JTAG debug port (JTAG-DP) provides a 5-pin standard JTAG interface to the AHP-AP port●The serial wire debug port (SW-DP) provides a 2-pin (clock + data) interface to the AHP-AP portIn the SWJ-DP , the two JTAG pins of the SW-DP are multiplexed with some of the five JTAG pins of the JTAG-DP .4.3 Pinout and debug port pinsThe STM32F20xxx/21xxx MCU is offered in various packages with different numbers of available pins. As a result, some functionality related to the pin availability may differ from one package to another.4.3.1 SWJ debug port pinsFive pins are used as outputs for the SWJ-DP as alternate functions of general-purpose I/Os (GPIOs). These pins, shown in Table 2, are available on all packages.%VALUATION BOARD(OST 0#0OWER SUPPLY*4!' 37 CONNECTOR$EBUG TOOLAI BAN3320Debug managementDoc ID 18267 Rev 219/294.3.2 Flexible SWJ-DP pin assignmentAfter reset (SYSRESETn or PORESETn), all five pins used for the SWJ-DP are assigned as dedicated pins immediately usable by the debugger host (note that the trace outputs are not assigned except if explicitly programmed by the debugger host).However, some of the JTAG pins shown in Table 3 can be configured to an alternate function through the GPIOx_AFRx registers.Table 3 shows the different possibilities to release some pins.For more details, see the STM32F20xxx/21xxx (RM0033) reference manual, available from the STMicroelectronics website /doc/20ec15b314791711cd7917a6.html .4.3.3 Internal pull-up and pull-down resistors on JTAG pinsThe JTAG input pins must not be floating since they are directly connected to flip-flops to control the debug mode features. Special care must be taken with the SWCLK/TCK pin that is directly connected to the clock of some of these flip-flops. Table 2.Debug port pin assignmentSWJ-DP pin nameJTAG debug portSW debug portPinassignment TypeDescription Type Debug assignment JTMS/SWDIO I JTAG test mode selection I/O Serial wire data input/output PA13JTCK/SWCLK I JTAG test clock I Serial wire clock P A14JTDII JTAG test data input --P A15JTDO/TRACESWO O JTAG test data output -TRACESWO if async traceis enabled PB3JNTRSTIJTAG test nReset。
st cubeide flash烧写算法

st cubeide flash烧写算法随着嵌入式系统的不断发展,对于Flash烧写算法的需求也越来越大。
作为一种重要的存储介质,Flash在嵌入式系统中扮演着至关重要的角色。
而st cubeide作为一款嵌入式开发工具,其Flash烧写算法更是备受关注。
本文将就st cubeide Flash烧写算法展开详细的介绍和分析。
一、st cubeide概述st cubeide是由意法半导体公司(STMicroelectronics)推出的集成开发环境(IDE),主要用于开发和调试ST的STM32系列单片机。
st cubeide具有强大的功能和丰富的工具链,对于嵌入式系统的开发十分便捷高效。
二、Flash烧写算法的重要性Flash烧写算法是指将程序或数据写入Flash中的一种算法,它直接关系到嵌入式系统的可靠性和稳定性。
在嵌入式系统中,Flash烧写算法的良好性能对于产品的质量和稳定性具有至关重要的作用。
Flash烧写算法的设计和实现是开发工程师们需要重点关注和深入研究的技术方向之一。
三、st cubeide Flash烧写算法的实现st cubeide针对不同的STM32系列单片机,为开发者提供了灵活多样的Flash烧写算法实现方式。
在st cubeide中,通过设置Flash烧写算法的参数、选择合适的算法模块等操作,即可轻松实现对Flash的烧写和擦除。
st cubeide灵活丰富的Flash烧写算法接口,使得开发者能够便捷快速地完成对Flash的操作,大大提高了开发效率。
四、st cubeide Flash烧写算法的优势相比于其他开发工具,st cubeide具有独特的优势和特点,使得其在Flash烧写算法的实现上具有明显的优势。
st cubeide提供了丰富的示例代码和文档,方便开发者学习和使用。
st cubeide具有友好的用户界面和强大的调试功能,能够帮助开发者快速定位和解决问题。
再次,st cubeide支持多种连接方式,包括仿真器、调试器等,满足不同场景下的需求。
MSP-EXP430G2开发板使用简单介绍

(4)、中断的嵌套:
当同时有多个中断来的时候才有优先级的考虑(优先级顺序可查看向量表)
实现中断嵌套需要注意以下几点: 1)430默认的是关闭中断嵌套的,一定要中断嵌套的话,就必须在中断服务程序中打开 总中断 msp430的指令中,_DINT()和_EINT()分别指关和开总中断。 2)当进入中断服务程序时,只要不在中断服务程序中再次开中断,则总中断是关闭的, 此时来中断不管是比当前中断的优先级高还是低都不执行; 3)若在中断服务程序A中开了总中断,则可以响应后来的中断B(不管B的优先级比A高 还是低),B执行完再继续执行A。注意:进入中断服务程序B后总中断同样也会关闭, 如 果B中断程序执行时需响应中断C,则此时也要开总中断,若不需响应中断,则不用 开中断,B执行完后跳出中断程序进入A程序时,总中断会自动打开; 4)若在中断服务程序中开了总中断,后来的中断同时有多个,则会按优先级来执行,即 中断优先级只有在多个中断同时到来时才起做用!中断服务不执行抢先原则。 5)对于单源中断,只要响应中断,系统硬件自动清中断标志位,对于TA/TB定时器的比较/捕 获中断,只要访问TAIV/TBIV,标志位倍被自动清除; 对于多源中断要手动清标志位,比如P1/P2口中断,要手工清除相应的标志,如果在这种中 断用"EINT();"开中断,而在打开中断前没有清标志,就会 有相同的中断不断嵌入,而导致 堆栈溢出引起复位,所以在这类中断中必须先清标志再打开中断开关.
Clock
FLASH
... JTAG/Debug
RAM
MAB 16
RISC CPU 16-bit
MDB 16
...
ACLK SMCLK
Digital Peripheral
Analog Peripheral
STM32F429I-DISCO开发板用户手册说明书

Open429Z-D User ManualContents1. Hardware introduction (2)1.1. What’s on board (2)2. Demo (4)2.1. ADC+DMA (4)2.2. CAN1 TO CAN2-Normal (5)2.3. DAC (5)2.4. DS18B20 (6)2.5. OV2640 (6)2.6. GPIO_Key (7)2.7. I2C (7)2.8. I2S_UDA1380 (8)2.9. NandFlash_SCB0 (8)2.10. SAI (9)2.11. SD_FatFS (9)2.12. SDIO (9)2.13. SPI (10)2.14. USART (11)3. Version update records (11)1. Hardware introduction 1.1. What’s on board[ Core interface ]1. STM32F429I-DISCO socketfor easily connecting the STM32F429I-DISCO 2. MCU pins connectorall the MCU I/O ports are accessible onexpansion connectors for further expansion 3. USB connectorUSB to UART via PL2303 USB TO UART board onboard MCU4. I2C1 / I2C2interface[ Other interfaces ]16. 5V DC jack17. 5V/3.3 V power input/outputusually used as power output, alsocommon-grounding with other user board 18. JTAG/SWD interfacefor debugging/programming[ Jumper ]easily connects to I2C peripherals such as I/O expander (PCF8574), FRAM (FM24CLXX), etc. 5. I2S2 / I2S3 / I2C1 interfacefor connecting I2S peripherals, such as Audio module.6. DCMI interfacefor connecting camera module 7. SDIO interfacefor connecting Micro SD module, features much faster access speed rather than SPI 8. CAN1 interfacecommunicates with accessory boards which feature the CAN device conveniently 9. CAN2 interfacecommunicates with accessory boards which feature the CAN device conveniently 10. UART3 interfaceeasily connects to RS232, RS485, USB TO 232, etc11. SPI1/SPI4 + AD/DA interfaceeasily connects to SPI peripherals such as DataFlash (AT45DBxx), SD card, MP3 module, etc MP3SPI1 features AD/DA alternative function, supports connecting AD/DA module as well 12. UART2 interfaceeasily connects to RS232, RS485, USB TO 232, etc13. 8-bit FSMC interfaceeasily connects to peripherals such as NandFlash, Ethernet, etc 14. SAI1 interfacefor connecting Audio peripherals, such as UDA1380 etc15. One-WIRE interfaceeasily connects to ONE-WIRE devices (TO-92 package), such as temperature sensor (DS18B20), electronic registration number (DS2401), etc.16. Joystick jumpershort the jumper to connect the joystick to default I/Os used in example code;open the jumper to connect the joystick to custom I/Os via jumper wires. 17. BOOT mode switchfor configuring BOOT0 pin 18. USB TO UART jumper[ Components ] 16. AMS1117-3.33.3V voltage regulator 17. PL2303USB to UART MCU 18. 5V DC jack 19. Power LED20. UART1 indicator LED 21. Joystickfive positions2. DemoKEIL MDK Version :4.7Programmer/Debugger: STM32F429I-DISCO onboard ST-LINK V2 Programming/Debugging interface: SWDConnect PC to the onboard USB TO UART connector via USB wireSerial port settings:2.1. ADC+DMA◆ OverviewAD acquisition demo◆ Hardware connectionConnect Analog Test Boardto SPI1(ADC+DAC )connector◆ Operation and resultRotate the onboard potentiometer, the below message will be printed on the serial debugging assistant:Select a proper COM port Baud rate115200Data bits 8Stop bits 1 Parity bits None Flow controlNone2.2. CAN1 TO CAN2-Normal◆ OverviewCAN demo◆ Hardware connection◆ Hardware connectionConnect the two CAN modules to theonboard CAN interfaces◆ Operation and resultYou may see the below result on the serial debugging assistant:2.3. DAC◆ OverviewDAC demo◆ Hardware connectionConnect the Analog Test Board to the SPI1(ADC+DAC )connectorConnect the Analog Test Board onboard 5Vinterface to the board onboard 5V interface viajumper wire.◆ Operation and resultYou may hear sound from the Analog Test Board2.4. DS18B20◆ OverviewDS18B20 demo◆ Hardware connectionConnect the DS18B20 module to the one-wire connector ◆ Operation and resultThe below information will be printed on the serial debugging assistant2.5. OV2640◆ OverviewCamera OV2640 demo ◆ Hardware connectionConnect the OV2640 Camera Board tothe onboard DCMMI connectorLaunch the serial debugging assistant, configuring the data as below: COM: COM3Baud rate: 115200 Data bits: 8 Parity bits: NO Stop bits: 1◆ Operation and result:Press “user” key, the captured image displayed on the serial debugging assistant:2.6. GPIO_Key◆ Overviewjoystick demo◆ Hardware connectionShort the JOYSTICK JMP on board ◆ Operation and resultPress the joystick, message will be printed on the serial debugging assistant accordingly.2.7. I2C◆ OverviewI2C EEPROM demo ◆ Hardware connectionConnect the AT24/FM24 Board to the board viaI2C connector (I2C1 or I2C2, depending on the software configuration).◆ Software configurationThe module connect to I2C1 connectorThe module connect to I2C2 connector #define Open_I2C1 //#define Open_I2C2//#define Open_I2C1 #define Open_I2C2◆ Operation and resultThe below information will be printed on the serial debugging assistant:2.8. I2S_UDA1380◆ OverviewI2S_UDA1380 demo ◆ Hardware connectionConnect the UDA1380 Board to the board via I2Sconnector.Connect the earphone to the UDA1380 Board viaLINEOUT connector◆ Operation and resultYou should hear music when press the RESET key2.9. NandFlash_SCB0◆ OverviewNandFlash demo ◆ Hardware connectionConnect the NandFlash Board to theboard via I2C2 connector.◆ Operation and resultThe below information will be printed on the serial debugging assistant:2.10. SAI◆ OverviewSAI demo◆ Hardware connectionConnect UDA1380 Board to the board via SAI1connector.Connect the earphone to the UDA1380 Board viaLINEOUT connector.◆ Operation and resultYou should hear music when press the RESET key.2.11. SD_FatFS◆ OverviewSD_FatFS demo ◆ Hardware connectionConnect the Micro SD Storage Board to theboard via SDIO connector.Insert the SD card to the Micro SD Storage Board socket.◆ Operation and resultMessage will be printed on the serial debugging assistant.2.12. SDIO◆ OverviewSDIO demo◆Hardware connectionConnect the Micro SD Storage Board to theboard via SDIO connector.Insert the SD card to the Micro SD Storage Board socket.◆ Operation and resultMessage will be printed on the serial debugging assistant.2.13. SPI◆ OverviewSPI demo◆ Hardware connectionConnect the AT45DBXX DataFlash Board via SPIconnector. (SPI1 or SPI4, depending on the software configuration◆ Software connectionModule connect to SPI1 connectorModule connect toSPI4 connector #define Open_SPI1 //#define Open_SPI4//#define Open_SPI1 #define Open_SPI4◆ Operation and resultInfo/messages printed on the serial debugging assistant:11 2.14. USART◆ OverviewUSART demo◆ Hardware connection◆ Operation and resultInfo/messages printed on the serial debugging assistant:3. Version update records VersionModification Date Author V1.0Initial Release 2014/05/17 Waveshare team。
cubeide使用技巧

cubeide使用技巧【最新版3篇】篇1 目录1.概述 CubeIDE2.CubeIDE 的基本功能3.CubeIDE 的安装与配置4.CubeIDE 的使用技巧5.CubeIDE 的优点与不足篇1正文CubeIDE 是一款功能强大的集成开发环境 (IDE),可以帮助开发人员快速、高效地开发各种应用程序。
本文将介绍 CubeIDE 的使用技巧,帮助读者更好地利用这个工具进行开发。
1.概述 CubeIDECubeIDE 是一款跨平台的集成开发环境,支持多种编程语言,例如Java、C++、Python 等。
它还提供了许多功能,例如代码编辑、调试、测试和构建等,让开发人员可以一站式完成应用程序的开发和部署。
2.CubeIDE 的基本功能CubeIDE 具有许多基本功能,例如代码编辑、调试、测试和构建等。
其中,代码编辑功能包括语法高亮、自动补全、代码折叠等,可以帮助开发人员更快速、更高效地编写代码。
调试功能可以让开发人员在开发过程中及时发现和解决问题。
测试功能可以让开发人员在开发过程中对代码进行单元测试,以确保代码的质量。
构建功能可以让开发人员轻松地将应用程序部署到目标平台上。
3.CubeIDE 的安装与配置安装 CubeIDE 非常简单,只需要下载官方网站上的安装程序并按照提示进行安装即可。
安装完成后,需要对 CubeIDE 进行配置,例如设置编译器、调试器和构建工具等。
配置完成后,就可以开始使用 CubeIDE 进行开发了。
4.CubeIDE 的使用技巧CubeIDE 提供了许多使用技巧,例如快捷键、模板和宏等,可以帮助开发人员更快速、更高效地开发应用程序。
下面是一些常用的使用技巧: - 快捷键:CubeIDE 提供了许多快捷键,例如 Ctrl+C 复制、Ctrl+V 粘贴、Ctrl+Z 撤销等,可以让开发人员更快速地操作。
- 模板:CubeIDE 提供了许多模板,例如 Java 类模板、C++类模板等,可以让开发人员更快速地创建代码文件。
MSP单片机(精品)

单片机的发展趋势
» 单片机发展为嵌入式处理器 单片机位数从4位、8位提高到16位、32位,从单CPU向多CPU发展。32位单片机由 于处理能力和开发方法已经和传统的单片机大相径庭,一般被称为嵌入式处理器, 成为数字系统设计的另外一个分支。
» 集成度进一步提高 单片机内部集成的设备越来越多,包括SRAM、FLASH ROM、E2ROM、AD、DA、PWM、 UART控制器、I2C控制器、 USB控制器、看门狗、上电复位电路、RC振荡器、FPGA 等,真正做到了SOC。
Z80 、MC6800系列等
Z80系列是8051系列流行之前非常流行的单片机,目前几乎没有人使用; 6800系列是Motorola公司80年代末推出的产品,采用RISC结构,成本低廉; 在低端大批量中占有优势。
目前热门的单片机(1)
51增强系列
8051为Intel公司80年代初推出,是目前普及度最广、兼容品种 最多的单片机。标准8051速度较慢,需要12个时钟周期运行一 条指令;目前出现了各大公司都推出了高速的8051兼容内核, 典型的是Dallas公司设计的4指令周期8051内核和Cignal公司研 发的单指令周期8051内核,Cignal公司的增强8051内核运行大 部分指令仅需要一个时钟周期,最快的型号已经达到100Mips 的计算速度。
智能化的仪器仪表:单片机用于包括温度、湿度、流量、流速、电压、 频率、功率、厚度、角度、长度、硬度、元素测定等和各类仪器仪表 中,使仪器仪表数字化、智能化、微型化,功能大大提高。
日常生活中的电器产品:单片机可用于电子秤、录像机、录音机、彩 电、洗衣机、高级电子玩具、冰箱、照相机、家用多功能报警器等。
MSP430系列单片机 原理与应用
2015.03
arduino学习笔记

Arduino学习笔记arduino学习笔记1 - 什么是arduino?要了解arduino就先要了解什么是单片机,arduino平台的基础就是AVR指令集的单片机。
1、什么是单片机?它与个人计算机有什么不同?一台能够工作的计算机要有这样几个部份构成:中央处理单元CPU(进行运算、控制)、随机存储器RAM(数据存储)、存储器ROM(程序存储)、输入/输出设备I/O(串行口、并行输出口等)。
在个人计算机(PC)上这些部份被分成若干块芯片,安装在一个被称之为主板的印刷线路板上。
而在单片机中,这些部份全部被做到一块集成电路芯片中了,所以就称为单片(单芯片)机,而且有一些单片机中除了上述部份外,还集成了其它部份如模拟量/数字量转换(A/D)和数字量/模拟量转换(D/A)等。
2、单片机有什么用?实际工作中并不是任何需要计算机的场合都要求计算机有很高的性能,一个控制电冰箱温度的计算机难道要用酷睿处理器吗?应用的关键是看是否够用,是否有很好的性能价格比。
如果一台冰箱都需要用酷睿处理起来进行温度控制,那价格就是天价了。
单片机通常用于工业生产的控制、生活中与程序和控制有关(如:电子琴、冰箱、智能空调等)的场合。
下图就是一个Atmega328P-PU单片机,基于AVR指令集的8位处理器,频率20MHz,存储器空间32KB。
什么是Arduino?Arduino是一个能够用来感应和控制现实物理世界的一套工具。
它由一个基于单片机并且开放源码的硬件平台,和一套为Arduino板编写程序的开发环境组成。
Arduino可以用来开发交互产品,比如它可以读取大量的开关和传感器信号,并且可以控制各式各样的电灯、电机和其他物理设备。
Arduino项目可以是单独的,也可以在运行时和你电脑中运行的程序(例如:Flash,Processing,MaxMSP)进行通讯。
Arduino板你可以选择自己去手动组装或是购买已经组装好的;Arduino开源的IDE可以免费下载得到。
ide知识点大全

IDE知识点大全IDE(集成开发环境)是软件开发中常用的工具,为开发者提供了一站式的开发环境,包括代码编辑、编译、调试等多个功能。
本文将介绍IDE的基本概念和常见功能,以及如何选择适合自己的IDE。
1.IDE的概念 IDE是一种软件工具,它集成了多种开发工具和环境,方便开发者进行软件开发。
它通常包括代码编辑器、编译器、调试器、版本控制等功能。
2.常见IDE 目前市面上有许多常见的IDE可供选择,其中一些最受开发者欢迎的包括:–Eclipse:开源的Java IDE,支持多种编程语言,拥有丰富的插件生态系统。
–Visual Studio:微软的集成开发环境,支持多种编程语言,尤其适用于Windows平台开发。
–IntelliJ IDEA:Java开发的IDE,被认为是最好的Java IDE之一,功能强大且易于使用。
–Xcode:苹果公司的开发工具,适用于iOS和Mac应用程序开发。
–Android Studio:谷歌官方推出的Android应用开发工具,集成了Android SDK和各种开发工具。
3.IDE的基本功能 IDE提供了许多基本功能,使得开发变得更加高效和便捷。
–代码编辑器:IDE提供了专门的代码编辑器,支持语法高亮、自动补全、代码重构等功能,提高了编写代码的效率。
–编译器:IDE可以将源代码编译成可执行文件或库文件,让开发者可以直接运行和测试代码。
–调试器:IDE内置了调试器,可以帮助开发者进行代码调试,查找和修复bug。
–版本控制:许多IDE支持版本控制系统(如Git),方便团队协作和代码管理。
–构建工具:IDE通常集成了构建工具(如Maven、Gradle),可以自动化构建和管理项目。
4.如何选择合适的IDE 选择合适的IDE取决于多个因素,包括编程语言、项目需求和个人偏好。
–编程语言:不同的IDE对不同的编程语言支持不同程度,需要选择适合编程语言的IDE。
–项目需求:一些IDE专注于特定类型的项目开发,如移动应用开发、Web开发等,需要根据项目需求选择合适的IDE。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
幵箱时里面的介绍: 整体布局介绍:
英文版:
翻译版:
MSP432P401:
板子上面为仿真电路和功耗测量电路,下面为432主控芯片和外围器件
的开发环境是他的版本号是Product Info (overview)
MSP432处理器也可以用库函数和寄存器两种方式来编写程序的,库函数是用的最多的方式,我也用库函数的方式来编写MSP432 的程序。
MSP432P401R LaunchPad 包含48MHz ARM CortexM4F 内核,
95uA/MHz 工作功耗和850nA RTC 操作,14位1MPS差动SAR ADC和AES256加速器。
评估板包含带有En ergyTrace+ 技术的板载仿真器,无需其他工具即可进行项目编程和调试,同时还可以测量系统总能耗。
P432P401R 处理器特性
低功耗、高性能MSP432P401R MCU
带浮点单元和DSP加速功能的48MHz 32 位ARM Cortex M4F
功耗:95uA/MHz 工作功耗和850nA RTC 待机操作功耗
模拟:24通道14位差动1MSPS SAR ADC,两个比较器
数字:高级加密标准(AES256)加速器、CRC、DMA、32位硬件乘法器
存储器:256KB闪存、64KB RAM
计时器:4个16位、2个32位
通信:多达4个I2C、8个SPI、4个UART
40引脚BoosterPack 连接器,支持20引脚BoosterPack
采用EnergyTrace+ 技术的板载XDS-110ET仿真器
2个按钮和2个LCD,便于用户交互
更多关于 MSP432的资料:
MSP432处理器可以使用 CCS 、IAR 和keil uVision IDE 来开发
整块电路板的框图:
以电路板上中间的虚线划分为上下两部分,介绍一下上面部分,
上面部分是 XDS110七T 仿真器,
MSP432P401R 与 XDS110ET 勺连接可以断开, MSP432P401R 与XDS110七T 除仿真信
号之外没有其他通讯连接, 仿真信号包括XDS110七T 串行调试信号、应用UART 言
号和、5V 电源。
F 面的图表很清楚的描述了两个区域的连接情况:
信号
连接方式 描述
5V 跳线 USB 过来的5V 电源
3V3 跳线 从XDS110-ET 过来的
RTS 跳线 UART 通道 CTS 跳线 UART 通道
RXD 跳线 接收数据 TXD 跳线 发送数据 RST
按键
复位MCU
TCK-SWCLK 拨动开关 串行输入/JTAG 输出
注:和为串口通讯时的半双工通信
评估板也可以外接仿真器,
是用外部仿真器
来选择板载XDS110仿真器还。