Quantcast
Channel: Renesas Synergy Platform
Viewing all articles
Browse latest Browse all 23645

Forum Post: RE: DK-S124 USBX Example

$
0
0
Hello, I've built a simple console application project (link at the bottom). Here are the steps (taken mostly from CDC ACM device example for S7G2 and SSP User's Manual): 1. Create DK-S124 project. 2. On BSP tab, set heap size to 0 and main stack size to 0x400. 3. Create a thread. 4. Add Framework -> Services -> Console. 5. For "Add Communications Framework" select New -> Comms... sf_el_ux_comms. 6. For "Add USBX Port DCD" select New -> USBX Port DCD on sf_el_ux for USBFS. 7. In properties for USBX Port DCD set the interrupt priority between 0 and 2. 8. In "USBX Device Configuration" set class code to Miscellaneous. 9. In "USBX on ux" set USBX pool memory size to 4096. 10. In the thread, define your menu and commands and call prompt inside the while(1). For example: #include "main_thread.h" void callback_led_on(sf_console_callback_args_t * p_args); void callback_led_off(sf_console_callback_args_t * p_args); const sf_console_command_t root_commands[2] = { { .command = (uint8_t *) "led_on", .help = (uint8_t *) "Turn LED1 on", .callback = callback_led_on, .context = NULL }, { .command = (uint8_t *) "led_off", .help = (uint8_t *) "Turn LED1 off", .callback = callback_led_off, .context = NULL } }; const sf_console_menu_t g_sf_console_root_menu = { .menu_prev = NULL, .menu_name = (uint8_t *) "root", .num_commands = 2, .command_list = root_commands }; /* Main Thread entry function */ void main_thread_entry(void) { UINT status; while (1) { status = g_sf_console0.p_api->prompt(g_sf_console0.p_ctrl, NULL, TX_WAIT_FOREVER); if (status) __BKPT(0); } } void callback_led_on(sf_console_callback_args_t * p_args) { SSP_PARAMETER_NOT_USED(p_args); g_ioport.p_api->pinWrite(IOPORT_PORT_05_PIN_01, IOPORT_LEVEL_HIGH); } void callback_led_off(sf_console_callback_args_t * p_args) { SSP_PARAMETER_NOT_USED(p_args); g_ioport.p_api->pinWrite(IOPORT_PORT_05_PIN_01, IOPORT_LEVEL_LOW); } This creates a simple menu with 2 commands to toggle the red LED (LED1) on the board. Project is attached here: (Please visit the site to view this file) Regards

Viewing all articles
Browse latest Browse all 23645

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>