Instruction manual
Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 68 of 157
Apr 1, 2013
4.9.5 Peripheral mode example
The following uses RX62N in an example to show how to setup USB-BASIC-FW and sample program to operate as a
USB peripheral.
1. Select HwResourceForUSB
Delete the content of folder "HwResourceForUSB”. Copy and paste the content of "HwResourceForUSB_RX62N" into
"HwResourceForUSB". The folders named HwResourceForUSB_XXX are not used by any build configuration.
2. Select USB mode (Host/Peripheral)
Set macros USB_FUNCSEL_USBIP0_PP and USB_FUNCSEL_USBIP1_PP in the User Configuration file
(r_usb_usrconfig.h) as follows.
//#define USB_FUNCSEL_USBIP0_PP USB_HOST_PP // Host Mode
#define USB_FUNCSEL_USBIP0_PP USB_PERI_PP // Peripheral Mode
//#define USB_FUNCSEL_USBIP0_PP USB_NOUSE_PP
//#define USB_FUNCSEL_USBIP1_PP USB_HOST_PP // Host Mode
//#define USB_FUNCSEL_USBIP1_PP USB_PERI_PP // Peripheral Mode
#define USB_FUNCSEL_USBIP1_PP USB_NOUSE_PP
3. Workspace
Double click “Fw.hws” to start up HEW. Then set the build configuration in the workspace to “PERI”.
4. Generate an executable file
From the tabs at the top of the workspace, select [Build Æ Build all], then execute the build.
5. Connect to evaluation board
From the tabs at the top of the workspace, select [DebugÆ Connect], and then connect the evaluation board to the
emulator.
6. Download and execute the binary executable in the target
From the tabs at the top of the workspace, select [DebugÆ DownloadÆ (target execute file)], and then download the
binary executable file to the evaluation board.
From the tabs at the top of the workspace, select [DebugÆ Reset then execute], to run target board.