1. Trang chủ
  2. » Truyện scan

Giáo trình Hệ thống nhúng: Phần 2

10 10 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Dòng ARM Cortex™-M là thế hệ mới, thiết lập các tiêu chuẩn mới về hiệu suất, chi phí, ứng dụng cho các thiết bị cần tiêu thụ năng lượng thấp, và đáp ứng yêu cầu thời gian thực khắc khe[r]

(1)

CHƯƠNG LẬP TRÌNH NHÚNG TRÊN ARM

4.1. GIỚI THIỆU ARM STM32

Lập trình nhúng khơng xa lại với chúng ta, STM32 chip ST, dựa lõi ARM Cortex-M Dòng ARM Cortex™-M hệ mới, thiết lập tiêu chuẩn hiệu suất, chi phí, ứng dụng cho thiết bị cần tiêu thụ lượng thấp, đáp ứng yêu cầu thời gian thực khắc khe

Hình 4.1 Hiệu ARM Cortex™-M

Một số tính có sử dụng STM32 như: từ điện tử dân dụng (tivi, đầu máy, máy giặt…), xe đời mới, game, mobile, laptop … chỗ ARM có mặt

TÍNH NĂNG NỔI BẬT:  Hiệu suất cao

Hình 4.2 Performance DMIP S/MHz

(2)

Hình 4.3 So sánh tiêu thụ lượng ARM VĐK 16 bit bit

 Code tương đối dễ support gần hết: ngoại vi (GPIO, I2C, SPI, ADC, USB, Ethernet, CAN….), ST cung cấp cho thư viện trực tiếp cho dòng ARM (gọi CMSIS – Cortex Microcontroller Software Interface Standard ), nhiệm vụ dễ dàng hơn: khai báo sử dụng mà …

 Giá rẻ: STM32F1x khoảng 29000 đồng STM32F1x chạy với tốc đọ 24Mhz

 Flash 16 128K

 37/51/80 chân I/O

 USART

 12 Timers

 16 kênh ADC -12bit

 I2C

 SPI

 Watchdog

 16 ngắt lập trình

 RTC (đồng hồ thời gian thực tích hợp)

 …

Hình 4.4 so sánh cách trực quan dòng VXL bit - 16 bit Cortex™-M qua hàm "nhân số 16 bit" (Cortex™-M nhân số 32 bit lệnh):

(3)

4.2. GIỚI THIỆU KIT

Vi xử lý ARM Cortex-M3 hệ dịng vi xử lý ARM cho hệ thống nhúng Nó phát triển để cung cấp cho hệ thống giá thành thấp gần giống với MCU, với việc cắt giàm chân lượng thấp, đảm bảo khả tính tốn đáp ứng ngắt cao ARM Cotext M3 dự kiến trúc vi xử lý RISC tối ưu hiệu mã lệnh, lực đảm bảo từ nhân ARM kích thước nhớ thường kết hợp với 16 bit

Dịng STM32F103 có nhân ARM tương thích với tất cơng cụ phần mền dành cho ARM Nó kết hợp hiệu cao từ ARM Cortex-M3 CPU với nhiều thiết bị ngoại vi nâng cao tính I/O STM32-103 Dev 1.0 cho phép bạn khám phá hồn tồn tính vi điều khiển ARM Cortex M3 STM32F103RDT6 phát triển từ ST Microelectronics Inc Một vài ứng dụng như: USB Mass Storage device, Audio class device, HID mouse device, CDC Virtual com port device …

Hình 4.5 KitSTM32F103RDT6 4.2.1 Đặc tính kit

1 MCU: STM32F103RDT6 ARM 32 bit CORTEX M3™ with 384K Program Flash, 64K Bytes RAM, USB, CAN, x2 I2C, x16 ADC, x2 DAC

3 x5 UART, x2 SPI, x12 TIMERS, up to 72Mhz operation

4 JTAG connector tiêu chuan v_i ARM 2x10 pin dành cho viec lập trình gỡ rối

5 USB connector

6 SD-MMC card, Audio, Microphone user buttions x3

(4)

10 RESET button 11 status LED

12 Mhz crystal oscillator

13 32768 Hz crystal and RTC backup battery 14 extension headers for all uC ports

15 Kích thước: 90.67 x 73.54mm (3.56 x 2.89") Yêu cầu từ board phát triển :

 Cáp USB 1.8m để nới với PC ( dành cho việc cấp nguồn giao tiếp  USB trường hợp dùng đến tính USB )

 Phần cứng : ARM-JTAG, ARM-USB-OCD, ARM-USB-TINY or other ARM JTAG compatible tool

 Phần mềm :

+ free open source platform: GNU C compiler + OpenOCD and Eclipse (support all low cost Olimex JTAG debuggers)

+ commercial solution EW-ARM from IAR Systems AB, require expensive J-LINK debugger

+ CrossWorks from Rowley (supports all Olimex low cost JTAG debuggers)

4.2.2 Đặc tính STM32F103RDT6 - CPU clock up to 72Mhz - FLASH 384KB

- RAM 64KB

- DMA x12 channels - RTC

- WDT

- Timers x11+1 - SPI x2

- I2C x2 - USART x5 - USB x1

- CAN x1 (multiplexed with USB so both can't be used in same time)

- GPIO up to 51 (multiplexed with peripherials) - 16 kênh ADC 12-bit, DAC x2

- operating voltage 2.0-3.6V - temperature -40C +85C RS232:

STM32F103RDT6 have USARTs which are available on the extension headers One of them can operate up to 4.5 Mbit/s, the other two up to 2.25 Mbit/s They provide hardware management of the CTS and RTS signals, IrDA SIR ENDEC support, are ISO 7816 compliant and have LIN Master/Slave capability.All USART interfaces can be served by the DMA controller

SPI:

(5)

3-bit prescaler gives master mode frequencies and the frame is configurable from 8-bit to 16-bit The hardware CRC generation/verification supports basic SD Card/MMC modes Both SPIs can be served by the DMA controller

I2C:

STM32F103RDT6 have two I²C bus interfaces which can operate in multi-master and slave modes They can supportstandard and fast modes They support dual slave addressing (7-bit only) and both 7/10-bit addressing in master mode A hardware CRC generation/verification is embedded They can be served by DMA and they support SM Bus 2.0/PM Bus

CAN:

The STM32F103RDT6 CAN is compliant with specifications 2.0A and B (active) with a bit rate up to Mbit/s It can receive and transmit standard frames with 11-bit identifiers as well as extended frames with 29-bit identifiers It has three transmit mailboxes, two receive FIFOs with stages and 14 scalable filter banks.The CAN and USB share same pins PA11 and PA12, so you can’t use both CAN and USB on same time

USB:

The STM32F103RDT6 embeds a USB device peripheral compatible with the USB Fullspeed 12 Mbs The USB interface implements a full speed (12 Mbit/s) function interface It has software configurable endpoint setting and suspend/resume support The dedicated 48 MHz clock source is generated from the internal main PLL.The CAN and USB share same pins PA11 and PA12, so you can’t use both CAN and USB on same time

ADC:

STM32F103RDT6 have two 12-bit Analog to Digital Converters which share up to 16 external channels, performing conversions in singleshot or scan modes In scan mode, automatic conversion is performed on a selected group of analog inputs Additional logic functions embedded in the ADC interface allow: - Simultaneous sample and hold

- Interleaved sample and hold - Single shunt

The ADC can be served by the DMA controller.An analog watchdog feature allows very precise monitoring of the converted voltage of one, some or all selected channels An interrupt is generated when the converted voltage is outside the programmed thresholds The events generated by the standard timers (TIMx) and the Advanced Control timer (TIM1) can be internally connected to the ADC start trigger, injection trigger, and DMA trigger respectively, to allow the application to synchronize A/D conversion and timers

(6)(7)(8)

4.2.4 Hướng dẫn set jump cho board

(9)

Cấp nguồn ( DC 5V )

(10) Lập trình nhúng

Ngày đăng: 09/03/2021, 03:42

Xem thêm:

w