MCU單晶片韌體設計

2016年4月29日 星期五

溫故知新--Essential C++


個人在大學時期就拜讀過候捷大師譯的兩本書,《 C++  Primer 中文版》、《Essential C++ 中文版》。如果你是新手想要學,個人認為可先以《Essential C++ 中文版》作為第一本導入門教材的確不錯,因為它只有200多頁,書沒有太厚,至少你不會覺得讀完遙遙無期,但仍然給了你C++語言的正確觀念! 現在很多的C++書都是C語言的翻版而已,加了一點 class 和繼承,就以爲是OO,其實還差得很遠。

很多人只是用了C++ compiler , 但程式內容和 C 沒有什麼兩樣,也看不出 OO 的設計精神!  把 printf 改用 cout 不等同於會 C++






《Essential C++ 中文版》你可以深入了解:

• Generic programming and the Standard Template Library (STL)
• Object-based programming and class design
• Object-oriented programming and the design of class hierarchies
• Function and class template design and use
• Exception handling and Run-Time Type Identification

2016年4月25日 星期一

Pi 新手教學(一) --- 使用Wind32 Disk Imager 燒錄卬象檔



下載Wind32 Disk Imager , 執行後進以下動作, 選擇image, 然後按"Write"即入將Pi image 寫入到
micro SD上, 完成後, 再將SD卡插回raspberry Pi , 插電即可啓動Raspbian 系統。
PS. 可以到Raspberry Pi 官網, 下載 Image (下載)



啓動了但你沒有看到輸出訊息,那是正常的..

如何看到輸出畫面? 

  1. 接UART Console 終端機 (如何使用UART Console 登入Raspberry Pi )
  2. 或連接 HDMI 螢幕

2022 年開始Raspberry 的預設帳號Pi 不存在了! 要自己建立Pi 帳號
http://blog.ittraining.com.tw/2023/07/raspberry-pi.html  

2016年4月14日 星期四

Seeed Arch Link 板子介紹

Seeed Arch Link

Arch Link is an mbed enabled development board based on Nordic nRF51822 and WIZnet W5500 ethernet interface. With Arduino form factor, Grove connectors and micro SD interface, it is extremely easy to create a bluetooth low energy device.



/media/uploads/JackyZhangFromSeeed/arch_link_pinout_a_20150602.png

什麼是CMSIS-DAP?


  簡單說, CMSIS-DAP 就是長出一個USB Flash disk , 可以用拖曳檔案到flash disk , 即是進行傳輸firmware到板子上的動作(upgrade firmware。  Windows 上出現隨身碟USB MSC界面,並不代表這是一個真實的file system, 可以用來儲存/更新檔案資料。DAP 就是Debug Access Port,只是以隨身碟的面貌存在於系統。

  • The CMSIS-DAP Interface is a microcontroller based single chip solution that provides, Drag and Drop programming, CMSIS-DAP debugger and USB serial interface to a range of Cortex-M based microcontrollers.
  • DAP over JTAG or SWD
  • The mbed HDK and mbed-enabled hardware support the CMSIS-DAP debug interface, which consists of an abstraction of the Cortex Debug Access Port (DAP) command set over a driver-less USB HID connection.
  • USB Serial interface between the host computer and the target
  • Packets are exchanged between the host debugger and the Interface Chip. Basically, the host sends a command and the debug unit sends the response of the command. 
  • The firmware that supports CMSIS-DAP for your target and an offline tool that support CMSIS-DAP - Keil MDK v4.60 for example

Notes on JTAG and SWD

JTAG (Joint Test Action Group) : 5 pin
SWD ((Serial Wire Debug): 2 pin
Serial Wire Debug technology is available as part of the CoreSight™ Debug Access Port and provides a 2-pin debug port, the low pin count and high-performance alternative to JTAG.
SWD 可以完全用來取代JTAG, 原本JTAG 的5 pin中的TMS and TCK pins, 就是SWD的SWDIO and SWCLK,


/media/uploads/samux/cmsis-dap-6.png




/media/uploads/emilmont/board.png
When the Onboard Interface ( LPC11U35 or KL25Z,..) is plugged to an host PC it enumerates as a composite device with the following interfaces:
  • MSD, mass storage device class
  • CDC, communications device class
  • HID, human interface device class
It is connected to the following pins of the target microcontroller:
  • SWD + Reset
  • UART
  • Sleep and Wake (Not currently implemented, reserved for future use)
/media/uploads/emilmont/interface.png
參考: 



2016年4月13日 星期三

OBD Interface

Communication protocols used in modern vehicles are incompatible with standard computer protocols (RS-232, USB, and so on). An OBD adapter (sometimes referred to as “vehicle interface adapter”) is an electronic device that allows a computer to access the vehicle network. It is similar in operation to a computer modem or a gateway, in that it translates messages from one protocol to another.
Normally, the data flows both ways — to and from the ECU. For example, in order to display the RPM or trouble codes, the following series of events must take place:
  1. Software sends a request for RPM to the OBD adapter via one of the standard channels (e.g., USB).
  2. OBD adapter receives the request, and retransmits it to the ECU on one of the OBD protocols (e.g., J1850).
  3. The ECU responds with the data, the OBD adapter relays the reply back to the software.
  4. The software decodes the reply, and displays it to the user.
OBD Adapter Connection Diagram



Elm327 WIFI OBD2/OBDII Wireless for iPhone/iPad/IPod/Android
1 This WIFI interface support all OBDII Protocls.
2 This WIFI OBD interface are fully compatible with many software, such as such as engine running parameters monitoring, DTC reading and clearing, MPG meter, etc.
IOT



enter image description here


OBD-II PIDs (On-board diagnostics Parameter IDs) are codes used to request data from a vehicle, used as a diagnostic tool.

2016年4月10日 星期日

各種車用通訊技術



車用通訊技術




行動通訊技術

  • GSM (Global System for Mobile Communications) 2G -- 9.6Kbps
  • GPRS (General packet radio services) 2.5G -- 35Kbps to 171kbps
  • EDGE (Enhanced Data rates for GSM Evolution) 2.75G -- 120Kbps to 384Kbps
  • UMTS (Universal Mobile Telecommunications System) 3G -- 384Kbps to 2Mbps
  • HSPA (software upgrade to UMTS, theoretical 42Mbps) 3.5G -- 600Kbps to 10Mbps, averages 1-3Mbps
  • WiMAX/LTE "4G" (theoretical 100Mbps) -- 3Mbps to 10Mbps average, 20Mbps+ peak download speeds.