W!o+ 的《小伶鼬工坊演義》︰ 一窺全豹之系統設計《硬體》

劉勰《文心雕龍‧事類

讚曰︰

經籍深富,辭理遐亙。皓如江海,鬱若昆鄧。

文梓共采,瓊珠交贈。用人若己,古來無懵。

 

基本上『 GrovePi 』的硬體設計只有一顆『 ATmegs 328p 』單晶片處理器,此事可見之於《 GrovePi-1.5_schem.pdf 》電路圖上。

 

GlovePi+

 

據知該舊文件現今或已不存,

 

GrovePi-1.5_schem

 

,讀者可考其《新文件》,實則相類也。這事能有什麼重要的嗎?若思『防呆』的四針『連接器』設計,在其針腳定義上,統合『 I2C 』 、『 UART serial 』、『 Digital 』與『 Analog 』接法,固然是方便簡易。

假使再思『 ATmegs328p 』之『 ISP 』

In-system programming

In-system programming (ISP), also called In-Circuit Serial Programming (ICSP), is the ability of some programmable logic devices, microcontrollers, and other embedded devices to be programmed while installed in a complete system, rather than requiring the chip to be programmed prior to installing it into the system.

There are several incompatible in-system programming protocols for programming microcontroller devices such as PIC microcontrollers, AVRs, and the Parallax Propeller. ICSP has been primarily implemented by Microchip Technology for programming PIC and dsPIC devices.

The primary advantage of this feature is that it allows manufacturers of electronic devices to integrate programming and testing into a single production phase, and save money, rather than requiring a separate programming stage prior to assembling the system. This may allow manufacturers to program the chips in their own system’s production line instead of buying preprogrammed chips from a manufacturer or distributor, making it feasible to apply code or design changes in the middle of a production run.

Microcontrollers are typically soldered directly to a printed circuit board and usually do not have the circuitry or space for a large external programming cable to another computer.

Typically, chips supporting ISP have internal circuitry to generate any necessary programming voltage from the system’s normal supply voltage, and communicate with the programmer via a serial protocol. Most programmable logic devices use a variant of the JTAG protocol for ISP, in order to facilitate easier integration with automated testing procedures. Other devices usually use proprietary protocols or protocols defined by older standards. In systems complex enough to require moderately large glue logic, designers may implement a JTAG-controlled programming subsystem for non-JTAG devices such as flash memory and microcontrollers, allowing the entire programming and test procedure to be accomplished under the control of a single protocol.

An example of devices using ISP is the AVR line of micro-controllers by Atmel such as the ATmega series.

 

316px-Isp_headers.svg

6 & 10 pins ISP headers

───

 

設計,雖說是其來有自

 

ATmegs328p_ISP

 

,但是其在樹莓派『 GPIO 』定址之法,『 SPI 』界面之用

 

GrovePi_RPI-connector

 

,竟然恰合於

Initial setup of the ATmega

Before we can start to program the ATmega, we need to initialise the chip. The chip itself needs to be told about various parameters such as it’s clock speed, how much flash to reserve for the bootloader (none in our case) and so on.

This is known as “programming the fuses”.

The first thing to do is to connect the Gertboard to your Raspberry Pi and install 4 jumper wires from the Pi’s GPIO to the ATmegas ISP port. The manual has a much better picture than my photos show below, however:

The wires to connect up are as follows:

  • GPIO pin 8 -> ISP pin 5 (RESET)
  • GPIO pin 9 -> ISP pin 1 (MISO)
  • GPIO pin 10 -> ISP pin 4 (MOSI)
  • GPIO pin 11 -> ISP pin 3 (SCLK)

The obvious down-side of doing it this way is that you can’t use the Raspberry Pi’s SPI interface when developing code for the ATmega. Hopefully this will not be an issue.

───

 

,此事未免啟人疑竇??

因此本著『柯南精神』細究蛛絲馬跡,發現了樹莓派『擴充板』 Gertboard 始祖,當真是意料之外!!

 

Gordons Projects

Projects, Fun and Games from Gordon @ Drogon

Gertboard

The Gertboard is an add-on GPIO expansion and experimenter board for the Raspberry Pi computer. It comes with a large variety of components, including buttons, LEDs, A/D and D/A converters, a motor controller, and an ATmel ATmegs 328p AVR microcontroller which you can program using the standard Arduino IDE (with some minor modifications)

The Gertboard was designed by Gert van Loo, hence the name!

Gertboard with Raspberry Pi

Operation of the Gertboard is relatively straightforward. A ribbon cable connects the Raspberry Pi to the Gertboard. This is then broken out with a row of pins, so every GPIO signal is avalable for your use.

Some of these pins can be directly jumpered via standard 2-pin jumper links to on-board functions – e.g. with a pair of 2-pin jumpers, the serial Rx and Tx can be connected directly to the ATmega’s Tx and Rx respectively, and with a few more 2-pin jumpers, the SPI pins can be jumpered to the Gertboard SPI peripherals. The other pins are available for your own use, or to connect to other devices on the Gertboard itself.

───

 

今思或許

熱情自有感染力,良好設計理念自能傳承的耶!!??