Twin microcontroller board with PIC24FJ64GB002 : UsbStudy, Interface(CQ出版)

I have assembled a Twin USB-OTG board, which consists of two PIC24FJ64GB002.    The two PICs is connected with UART and have a USB type-A receptacle for a host respectively.    Moreover, selecting a jumper on the board, one of the PICs can have a USB type-B receptacle for a device alternatively.    A LCD module is,  however, fixed to one PIC.    In my board, the Fast Internal RC (FRC) Oscillator must be used , for no external resonator is equiped with.    Using this board, I will assess some USB firmware.

 

TWIN2

 

<< Pin connection >>

Red LED – RB0, Green LED – RB1;

Switch1 (pull down) – MCLR, Switch2 (pull down) – RB2;

LCD (SC1602BBWB-XA-GB-G) : RS – RB7, R/W – GND, E – RB8, Data bus: DB4 – RB9, DB5 – RB13, DB6 – RB14, DB7 – RB15, VDD – 5 volt (controlled by the left-side PIC);

 

 

<< Oscillator Configuration  >>

Fast RC Oscillator with PLL Module (FRCPLL) :

_CONFIG1(WDTPS_PS1 & FWPSA_PR32 & WINDIS_OFF & FWDTEN_OFF & ICS_PGx1 & GWRP_OFF & GCP_OFF & JTAGEN_OFF)
_CONFIG2(POSCMOD_NONE & I2C1SEL_PRI & IOL1WAY_OFF & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_FRCPLL & PLL96MHZ_ON & PLLDIV_DIV2 & IESO_OFF)
_CONFIG3(WPFP_WPFP0 & SOSCSEL_IO & WUTSEL_LEG & WPDIS_WPDIS & WPCFG_WPCFGDIS & WPEND_WPENDMEM)
_CONFIG4(DSWDTPS_DSWDTPS3 & DSWDTOSC_LPRC & RTCOSC_SOSC & DSBOREN_OFF & DSWDTEN_OFF)

 

 

<< UART >>

Setting I/O ports for UART1 :

RPINR18bits.U1RXR = 5; // Configure U1RX – put on pin 2 (RP5);
RPOR3bits.RP6R = 3; // Configure U1TX – put on pin 3 (RP6);

 

 

<< A demonstration experiment >>

HID device – USB – Host (24FJ64GB002) – UART – Device (24FJ64GB002) – USB – PC (UsbStudy.exe);

 

1)    The  revised UsbCDC into the USB-device PIC for my board :

 (A project of MPLAB X IDE containing HEX.file only)

 

2)    The revised UsbStudy into the USB-host PIC for my board :

 (A project of MPLAB X IDE containing HEX.file only)

 

3)    UsbStudy.exe :

http://www.cqpub.co.jp/interface/download/contents.htm )

 

 

<< Reference >>

Interface, No.12, 2014: CQ Publishing Co.,Ltd (Japan)