Ethernet and USB board using PIC24FJ256GB106 and ENC28J60

<< Introduction in Japanese >>
久々の電子工作としては今更と言われるだろうが、今回始めて TQFP (Thin Quad Flat Package) の半田付けに挑戦してみた。選んだチップは 64 ピンの PIC24FJ256GB106 で、2.54mm 変換基板に半田付けをした。ネットに上げられている幾つかのアドバイスに従えば、初めてでも TQFP の半田付けに成功できた事が嬉しかった。

今回の PIC24FJ256GB106 を使った実験ボード上には、イーサーネット・コントローラー ENC28J60 を併設し、外部インターフェースとして RJ-45 コネクタと USB receptacle (Type A) コネクタを実装させた。

PIC24FJ256GB106 には、 HTTP クライアントのコードを書き込んで、これをパソコンのウェブ・ブラウザからアクセスすることで動作確認を行った。

一つ予想外だったのは、PIC24FJ256GB106 が EEPROM を内蔵していない事で、HTML コードをプログラム・メモリに収める為に、そのサイズには注意を払う必要が生じた。実験では短い文字列だけのページとして、それが表示されることを確認するだけに留めた。大きな HTML コードを収める為には、外部 EEPROM が必要となる。

PIC24FJ256GB106 <— SPI —> ENC28J60 <— Ethernet —> Local area network

(TCP/IP protocols are included in the application code for the PIC24FJ256GB106.)

<< Architecture of the Ethernet board >>
The Ethernet controller, ENC28J60, is connected with the microcontroller, PIC24FJ256GB106, using the Serial Peripheral Interface (SPI).

Clock and pin connection of PIC24FJ256GB106 : The system clock of 48MHz is derived from the internal oscillator of 8MHz using the PLL module.

LED : pin 2 (RE6), pin 3 (RE7).
Switch (pull down) : pin 7 (MCLR), pin 8 (RG9).

LCD (SC1602BBWB-XA-GB-G) : VDD – 5 volt, RS – pin 64 (RE4), R/W – GND, E – pin 1 (RE5),
Data bus (4-bit mode) : DB4 – pin 60 (RE0), DB5 – pin 61 (RE1), DB6 – pin 62 (RE2), DB7 – pin 63 (RE3).

(Reproduced from the figure in the site of reference)

ENC28J60 :
Pin 4 INT  –-  Open (Out of use),
Pin 6 SO  –-  PIC pin 31 (RP10/RF4 assigned to SDI1),
Pin 7 SI  –-  PIC pin 32 (RP17/RF5 assigned to SDO1),
Pin 8 SCK  –-  PIC pin 33 (RP16/RE3 assigned to SCK1),
Pin 9 CS  –-  PIC pin 58 (RF0),
Pin 10 RESET  –-  Open (Internally pulled-up to VDD).

<< Sample code for the Ethernet board >>

(Compiled by the XC16 on the MPLAB X IDE)

In TCPIP ENC28.h, STACK_USE_ICMP_SERVER, STACK_USE_DHCP_CLIENT and STACK_USE_NBNS have been defined in this project. Consequently, the test board can practice the communications-protocol of ICMP, ARP, DHCP Client and NBNS.

The default network configuration in TCPIP ENC28.h must be adjusted to your local network (MAC address, IP address and so on).

Example above :
NetBIOS Name = PIC24FJ256GB106
Default MAC address = {0x00, 0x04, 0xA3, 0x00, 0x00, 0x00}
Default IP address = 192.168.1.10
Default subnet mast = 255.255.255.0
Default gateway = 192.168.1.1
Default primary DNS = 192.168.1.1
Default secondary DNS = 0.0.0.0

The connection to the Ethernet board can be checked by the ping on the Command Prompt of your Windows PC. And if the connection has been established, the test page can be viewed by a web-browser on your computer.

<< Reference >>
TCP/IP stack : Microchip Libraries for Applications v2013-06-15.