Read/write fail in USB PVND (no RTOS) on RA4M2

Hello wonderful community,

I am trying to implement a custom USB peripheral with an RA4M2 MCU on a custom board. This means I need a USB PVND stack.

Starting point:

- I have a USB PCDC demo running on my board (without RTOS)

- Switched to the PVND class using the standard example suite from FSP 4.3.0 pack. I adapted it for non-RTOS and for my own descriptor (cloned from a different board)

- The device is recognized by the Device Manager similarly to the other board and looks the same in USB analyzers.

- Using EP1 for bulk in/out. The DeviceAddress is different, but I assume that is dynamically allocated by the USB Host and does not matter.

- I use a PC driver that writes and then reads test data, and the driver itself works on the other board, so I consider the PC side ok.

Now comes the problem: none of the read/write operations succeed. Things I checked:

- The "usb_pvnd_write_complete" or "usb_pvnd_read_complete" never get called. They are the ones responsible to signal an event to the polling loop by calling "setEvent".

- Also looking into "usb_pstd_interrupt_handler", there are some requests coming (setup transaction and DVST) but never for BRDY, BEMP or NRDY, which I assume are required for read/write operations.

- When writing to the host, the second write command gives "BUSY", so the first write did not go through.

If someone can help, please let me know what other info/code fragments I can provide, or where can I do more digging.

Thank you in advance!

Alin

Parents
  • Hello,

    Thanks for  reaching out Renesas Engineering Community!

    Could you please provide us more details, such as your configurations on FSP Configurator?

    Best Regards,

    IK

  • Sure, I am attaching the config XML and a screenshot of the basic USB stack properties.

    It's the same config as the USB PCDC demo that works. I just replaced the PCDC with a PVND and also added a timer.

    Both PCDC and PVND are no-RTOS configs, so I assume the same XML should work. Plus the fact that the USB gets recognized should mean the basic HW config is ok.

    I would also exclude the polling loop as a culprit because the USB setup works and the problem seems to be a missing read/write event even before my polling loop.

    Best regards,

    A

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <raConfiguration version="7">
      <generalSettings>
        <option key="#Board#" value="board.custom"/>
        <option key="CPU" value="RA4M2"/>
        <option key="Core" value="CM33"/>
        <option key="#TargetName#" value="R7FA4M2AD3CFL"/>
        <option key="#TargetARCHITECTURE#" value="cortex-m33"/>
        <option key="#DeviceCommand#" value="R7FA4M2AD"/>
        <option key="#RTOS#" value="_none"/>
        <option key="#pinconfiguration#" value="R7FA4M2AD3CFL.pincfg"/>
        <option key="#FSPVersion#" value="4.2.0"/>
        <option key="#SELECTED_TOOLCHAIN#" value="gcc-arm-embedded"/>
        <option key="#ToolchainVersion#" value="10.3.1.20210824"/>
      </generalSettings>
      <raBspConfiguration>
        <config id="config.bsp.ra4m2.R7FA4M2AD3CFL">
          <property id="config.bsp.part_number" value="config.bsp.part_number.value"/>
          <property id="config.bsp.rom_size_bytes" value="config.bsp.rom_size_bytes.value"/>
          <property id="config.bsp.rom_size_bytes_hidden" value="524288"/>
          <property id="config.bsp.ram_size_bytes" value="config.bsp.ram_size_bytes.value"/>
          <property id="config.bsp.data_flash_size_bytes" value="config.bsp.data_flash_size_bytes.value"/>
          <property id="config.bsp.package_style" value="config.bsp.package_style.value"/>
          <property id="config.bsp.package_pins" value="config.bsp.package_pins.value"/>
          <property id="config.bsp.irq_count_hidden" value="96"/>
        </config>
        <config id="config.bsp.ra4m2">
          <property id="config.bsp.series" value="config.bsp.series.value"/>
        </config>
        <config id="config.bsp.ra4m2.fsp">
          <property id="config.bsp.fsp.tz.exception_response" value="config.bsp.fsp.tz.exception_response.nmi"/>
          <property id="config.bsp.fsp.tz.cmsis.bfhfnmins" value="config.bsp.fsp.tz.cmsis.bfhfnmins.secure"/>
          <property id="config.bsp.fsp.tz.cmsis.sysresetreqs" value="config.bsp.fsp.tz.cmsis.sysresetreqs.secure_only"/>
          <property id="config.bsp.fsp.tz.cmsis.s_priority_boost" value="config.bsp.fsp.tz.cmsis.s_priority_boost.disabled"/>
          <property id="config.bsp.fsp.tz.csar" value="config.bsp.fsp.tz.csar.both"/>
          <property id="config.bsp.fsp.tz.rstsar" value="config.bsp.fsp.tz.rstsar.both"/>
          <property id="config.bsp.fsp.tz.bbfsar" value="config.bsp.fsp.tz.bbfsar.both"/>
          <property id="config.bsp.fsp.tz.sramsar.sramprcr" value="config.bsp.fsp.tz.sramsar.sramprcr.both"/>
          <property id="config.bsp.fsp.tz.sramsar.sramecc" value="config.bsp.fsp.tz.sramsar.sramecc.both"/>
          <property id="config.bsp.fsp.tz.stbramsar" value="config.bsp.fsp.tz.stbramsar.both"/>
          <property id="config.bsp.fsp.tz.bussara" value="config.bsp.fsp.tz.bussara.both"/>
          <property id="config.bsp.fsp.tz.bussarb" value="config.bsp.fsp.tz.bussarb.both"/>
          <property id="config.bsp.fsp.cache_line_size" value="config.bsp.fsp.cache_line_size.32"/>
          <property id="config.bsp.fsp.OFS0.iwdt_start_mode" value="config.bsp.fsp.OFS0.iwdt_start_mode.disabled"/>
          <property id="config.bsp.fsp.OFS0.iwdt_timeout" value="config.bsp.fsp.OFS0.iwdt_timeout.2048"/>
          <property id="config.bsp.fsp.OFS0.iwdt_divisor" value="config.bsp.fsp.OFS0.iwdt_divisor.128"/>
          <property id="config.bsp.fsp.OFS0.iwdt_window_end" value="config.bsp.fsp.OFS0.iwdt_window_end.0"/>
          <property id="config.bsp.fsp.OFS0.iwdt_window_start" value="config.bsp.fsp.OFS0.iwdt_window_start.100"/>
          <property id="config.bsp.fsp.OFS0.iwdt_reset_interrupt" value="config.bsp.fsp.OFS0.iwdt_reset_interrupt.Reset"/>
          <property id="config.bsp.fsp.OFS0.iwdt_stop_control" value="config.bsp.fsp.OFS0.iwdt_stop_control.stops"/>
          <property id="config.bsp.fsp.OFS0.wdt_start_mode" value="config.bsp.fsp.OFS0.wdt_start_mode.register"/>
          <property id="config.bsp.fsp.OFS0.wdt_timeout" value="config.bsp.fsp.OFS0.wdt_timeout.16384"/>
          <property id="config.bsp.fsp.OFS0.wdt_divisor" value="config.bsp.fsp.OFS0.wdt_divisor.128"/>
          <property id="config.bsp.fsp.OFS0.wdt_window_end" value="config.bsp.fsp.OFS0.wdt_window_end.0"/>
          <property id="config.bsp.fsp.OFS0.wdt_window_start" value="config.bsp.fsp.OFS0.wdt_window_start.100"/>
          <property id="config.bsp.fsp.OFS0.wdt_reset_interrupt" value="config.bsp.fsp.OFS0.wdt_reset_interrupt.Reset"/>
          <property id="config.bsp.fsp.OFS0.wdt_stop_control" value="config.bsp.fsp.OFS0.wdt_stop_control.stops"/>
          <property id="config.bsp.fsp.OFS1.voltage_detection0.start" value="config.bsp.fsp.OFS1.voltage_detection0.start.disabled"/>
          <property id="config.bsp.fsp.OFS1.voltage_detection0_level" value="config.bsp.fsp.OFS1.voltage_detection0_level.280"/>
          <property id="config.bsp.fsp.OFS1.hoco_osc" value="config.bsp.fsp.OFS1.hoco_osc.disabled"/>
          <property id="config.bsp.fsp.BPS.BPS0" value=""/>
          <property id="config.bsp.fsp.PBPS.PBPS0" value=""/>
          <property id="config.bsp.fsp.hoco_fll" value="config.bsp.fsp.hoco_fll.disabled"/>
          <property id="config.bsp.common.main_osc_wait" value="config.bsp.common.main_osc_wait.wait_8163"/>
          <property id="config.bsp.fsp.mcu.adc.max_freq_hz" value="50000000"/>
          <property id="config.bsp.fsp.mcu.sci_uart.max_baud" value="20000000"/>
          <property id="config.bsp.fsp.mcu.adc.sample_and_hold" value="0"/>
          <property id="config.bsp.fsp.mcu.sci_spi.max_bitrate" value="25000000"/>
          <property id="config.bsp.fsp.mcu.spi.max_bitrate" value="50000000"/>
          <property id="config.bsp.fsp.mcu.iic_master.rate.rate_fastplus" value="1"/>
          <property id="config.bsp.fsp.mcu.sci_uart.cstpen_channels" value="0x0219"/>
          <property id="config.bsp.fsp.mcu.gpt.pin_count_source_channels" value="0xFFFF"/>
        </config>
        <config id="config.bsp.ra">
          <property id="config.bsp.common.main" value="0x3000"/>
          <property id="config.bsp.common.heap" value="0x6000"/>
          <property id="config.bsp.common.vcc" value="3300"/>
          <property id="config.bsp.common.checking" value="config.bsp.common.checking.disabled"/>
          <property id="config.bsp.common.assert" value="config.bsp.common.assert.none"/>
          <property id="config.bsp.common.error_log" value="config.bsp.common.error_log.none"/>
          <property id="config.bsp.common.soft_reset" value="config.bsp.common.soft_reset.disabled"/>
          <property id="config.bsp.common.main_osc_populated" value="config.bsp.common.main_osc_populated.enabled"/>
          <property id="config.bsp.common.pfs_protect" value="config.bsp.common.pfs_protect.enabled"/>
          <property id="config.bsp.common.c_runtime_init" value="config.bsp.common.c_runtime_init.enabled"/>
          <property id="config.bsp.common.early_init" value="config.bsp.common.early_init.disabled"/>
          <property id="config.bsp.common.main_osc_clock_source" value="config.bsp.common.main_osc_clock_source.crystal"/>
          <property id="config.bsp.common.subclock_populated" value="config.bsp.common.subclock_populated.enabled"/>
          <property id="config.bsp.common.subclock_drive" value="config.bsp.common.subclock_drive.standard"/>
          <property id="config.bsp.common.subclock_stabilization_ms" value="1000"/>
        </config>
      </raBspConfiguration>
      <raClockConfiguration>
        <node id="board.clock.xtal.freq" mul="24000000" option="_edit"/>
        <node id="board.clock.hoco.freq" option="board.clock.hoco.freq.16m"/>
        <node id="board.clock.loco.freq" option="board.clock.loco.freq.32768"/>
        <node id="board.clock.moco.freq" option="board.clock.moco.freq.8m"/>
        <node id="board.clock.subclk.freq" option="board.clock.subclk.freq.32768"/>
        <node id="board.clock.pll.source" option="board.clock.pll.source.hoco"/>
        <node id="board.clock.pll.div" option="board.clock.pll.div.2"/>
        <node id="board.clock.pll.mul" option="board.clock.pll.mul.160"/>
        <node id="board.clock.pll.display" option="board.clock.pll.display.value"/>
        <node id="board.clock.pll2.source" option="board.clock.pll2.source.hoco"/>
        <node id="board.clock.pll2.div" option="board.clock.pll2.div.1"/>
        <node id="board.clock.pll2.mul" option="board.clock.pll2.mul.120"/>
        <node id="board.clock.pll2.display" option="board.clock.pll2.display.value"/>
        <node id="board.clock.clock.source" option="board.clock.clock.source.pll"/>
        <node id="board.clock.clkout.source" option="board.clock.clkout.source.subclk"/>
        <node id="board.clock.uclk.source" option="board.clock.uclk.source.pll2"/>
        <node id="board.clock.iclk.div" option="board.clock.iclk.div.2"/>
        <node id="board.clock.pclka.div" option="board.clock.pclka.div.2"/>
        <node id="board.clock.pclkb.div" option="board.clock.pclkb.div.4"/>
        <node id="board.clock.pclkc.div" option="board.clock.pclkc.div.4"/>
        <node id="board.clock.pclkd.div" option="board.clock.pclkd.div.2"/>
        <node id="board.clock.fclk.div" option="board.clock.fclk.div.4"/>
        <node id="board.clock.clkout.div" option="board.clock.clkout.div.1"/>
        <node id="board.clock.uclk.div" option="board.clock.uclk.div.4"/>
        <node id="board.clock.iclk.display" option="board.clock.iclk.display.value"/>
        <node id="board.clock.pclka.display" option="board.clock.pclka.display.value"/>
        <node id="board.clock.pclkb.display" option="board.clock.pclkb.display.value"/>
        <node id="board.clock.pclkc.display" option="board.clock.pclkc.display.value"/>
        <node id="board.clock.pclkd.display" option="board.clock.pclkd.display.value"/>
        <node id="board.clock.fclk.display" option="board.clock.fclk.display.value"/>
        <node id="board.clock.clkout.display" option="board.clock.clkout.display.value"/>
        <node id="board.clock.uclk.display" option="board.clock.uclk.display.value"/>
      </raClockConfiguration>
      <raComponentSelection>
        <component apiversion="" class="BSP" condition="" group="ra4m2" subgroup="device" variant="R7FA4M2AD3CFL" vendor="Renesas" version="4.2.0">
          <description>Board support package for R7FA4M2AD3CFL</description>
          <originalPack>Renesas.RA_mcu_ra4m2.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="BSP" condition="" group="ra4m2" subgroup="device" variant="" vendor="Renesas" version="4.2.0">
          <description>Board support package for RA4M2</description>
          <originalPack>Renesas.RA_mcu_ra4m2.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="BSP" condition="" group="ra4m2" subgroup="fsp" variant="" vendor="Renesas" version="4.2.0">
          <description>Board support package for RA4M2 - FSP Data</description>
          <originalPack>Renesas.RA_mcu_ra4m2.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="CMSIS" condition="" group="CMSIS5" subgroup="CoreM" variant="" vendor="Arm" version="5.9.0+renesas.0.fsp.4.2.0">
          <description>Arm CMSIS Version 5 - Core (M)</description>
          <originalPack>Arm.CMSIS5.5.9.0+renesas.0.fsp.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="BSP" condition="" group="Board" subgroup="custom" variant="" vendor="Renesas" version="4.2.0">
          <description>Custom Board Support Files</description>
          <originalPack>Renesas.RA_board_custom.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="Common" condition="" group="all" subgroup="fsp_common" variant="" vendor="Renesas" version="4.2.0">
          <description>Board Support Package Common Files</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_dtc" variant="" vendor="Renesas" version="4.2.0">
          <description>Data Transfer Controller</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_gpt" variant="" vendor="Renesas" version="4.2.0">
          <description>General PWM Timer</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_icu" variant="" vendor="Renesas" version="4.2.0">
          <description>External Interrupt</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_ioport" variant="" vendor="Renesas" version="4.2.0">
          <description>I/O Port</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_sci_uart" variant="" vendor="Renesas" version="4.2.0">
          <description>SCI UART</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_spi" variant="" vendor="Renesas" version="4.2.0">
          <description>Serial Peripheral Interface</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_usb_basic" variant="" vendor="Renesas" version="4.2.0">
          <description>USB Basic</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
        <component apiversion="" class="HAL Drivers" condition="" group="all" subgroup="r_usb_pvnd" variant="" vendor="Renesas" version="4.2.0">
          <description>USB Peripheral Vendor Class</description>
          <originalPack>Renesas.RA.4.2.0.pack</originalPack>
        </component>
      </raComponentSelection>
      <raElcConfiguration/>
      <raIcuConfiguration/>
      <raModuleConfiguration>
        <module id="module.driver.ioport_on_ioport.0">
          <property id="module.driver.ioport.name" value="g_ioport"/>
          <property id="module.driver.ioport.elc_trigger_ioport1" value="_disabled"/>
          <property id="module.driver.ioport.elc_trigger_ioport2" value="_disabled"/>
          <property id="module.driver.ioport.elc_trigger_ioport3" value="_disabled"/>
          <property id="module.driver.ioport.elc_trigger_ioport4" value="_disabled"/>
          <property id="module.driver.ioport.pincfg" value="g_bsp_pin_cfg"/>
        </module>
        <module id="module.driver.spi_on_spi.2086473694">
          <property id="module.driver.spi.name" value="g_spi0"/>
          <property id="module.driver.spi.channel" value="0"/>
          <property id="module.driver.spi.rxi_ipl" value="board.icu.common.irq.priority4"/>
          <property id="module.driver.spi.txi_ipl" value="board.icu.common.irq.priority4"/>
          <property id="module.driver.spi.tei_ipl" value="board.icu.common.irq.priority4"/>
          <property id="module.driver.spi.eri_ipl" value="board.icu.common.irq.priority4"/>
          <property id="module.driver.spi.operating_mode" value="module.driver.spi.operating_mode.mode_master"/>
          <property id="module.driver.spi.clk_phase" value="module.driver.spi.clk_phase.clk_phase_edge_even"/>
          <property id="module.driver.spi.clk_polarity" value="module.driver.spi.clk_polarity.clk_polarity_high"/>
          <property id="module.driver.spi.mode_fault" value="module.driver.spi.mode_fault.mode_fault_error_disable"/>
          <property id="module.driver.spi.bit_order" value="module.driver.spi.bit_order.bit_order_msb_first"/>
          <property id="module.driver.spi.p_callback" value="user_spi_callback"/>
          <property id="module.driver.spi.spi_clksyn" value="module.driver.spi.spi_clksyn.spi_clksyn"/>
          <property id="module.driver.spi.spi_comm" value="module.driver.spi.spi_comm.full_duplex"/>
          <property id="module.driver.spi.ssl_polarity" value="module.driver.spi.ssl_polarity.low"/>
          <property id="module.driver.spi.ssl_select" value="module.driver.spi.ssl_select.zero"/>
          <property id="module.driver.spi.mosi_idle_value_fixing" value="module.driver.spi.mosi_idle_value_fixing.high"/>
          <property id="module.driver.spi.parity" value="module.driver.spi.parity_mode.disable"/>
          <property id="module.driver.spi.byte_swap" value="module.driver.spi.byte_swap.disable"/>
          <property id="module.driver.spi.bitrate" value="12000000"/>
          <property id="module.driver.spi.spck_delay" value="module.driver.spi.spck_delay.one"/>
          <property id="module.driver.spi.ssl_negation_delay" value="module.driver.spi.ssl_negation_delay.one"/>
          <property id="module.driver.spi.next_access_delay" value="module.driver.spi.next_access_delay.one"/>
        </module>
        <module id="module.driver.transfer_on_dtc.1054883147">
          <property id="module.driver.transfer.name" value="g_transfer0"/>
          <property id="module.driver.transfer.mode" value="module.driver.transfer.mode.mode_normal"/>
          <property id="module.driver.transfer.size" value="module.driver.transfer.size.size_2_byte"/>
          <property id="module.driver.transfer.dest_addr_mode" value="module.driver.transfer.dest_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.src_addr_mode" value="module.driver.transfer.src_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.repeat_area" value="module.driver.transfer.repeat_area.repeat_area_source"/>
          <property id="module.driver.transfer.p_dest" value="NULL"/>
          <property id="module.driver.transfer.p_src" value="NULL"/>
          <property id="module.driver.transfer.interrupt" value="module.driver.transfer.interrupt.interrupt_end"/>
          <property id="module.driver.transfer.length" value="0"/>
          <property id="module.driver.transfer.num_blocks" value="0"/>
          <property id="module.driver.transfer.activation_source" value="_disabled"/>
        </module>
        <module id="module.driver.transfer_on_dtc.1007961353">
          <property id="module.driver.transfer.name" value="g_transfer1"/>
          <property id="module.driver.transfer.mode" value="module.driver.transfer.mode.mode_normal"/>
          <property id="module.driver.transfer.size" value="module.driver.transfer.size.size_2_byte"/>
          <property id="module.driver.transfer.dest_addr_mode" value="module.driver.transfer.dest_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.src_addr_mode" value="module.driver.transfer.src_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.repeat_area" value="module.driver.transfer.repeat_area.repeat_area_source"/>
          <property id="module.driver.transfer.p_dest" value="NULL"/>
          <property id="module.driver.transfer.p_src" value="NULL"/>
          <property id="module.driver.transfer.interrupt" value="module.driver.transfer.interrupt.interrupt_end"/>
          <property id="module.driver.transfer.length" value="0"/>
          <property id="module.driver.transfer.num_blocks" value="0"/>
          <property id="module.driver.transfer.activation_source" value="_disabled"/>
        </module>
        <module id="module.driver.uart_on_sci_uart.1639526852">
          <property id="module.driver.uart.name" value="g_uart0"/>
          <property id="module.driver.uart.channel" value="0"/>
          <property id="module.driver.uart.data_bits" value="module.driver.uart.data_bits.data_bits_8"/>
          <property id="module.driver.uart.parity" value="module.driver.uart.parity.parity_off"/>
          <property id="module.driver.uart.stop_bits" value="module.driver.uart.stop_bits.stop_bits_1"/>
          <property id="module.driver.uart.baud" value="115200"/>
          <property id="module.driver.uart.baudrate_modulation" value="module.driver.uart.baudrate_modulation.disabled"/>
          <property id="module.driver.uart.baudrate_max_err" value="5"/>
          <property id="module.driver.uart.flow_control" value="module.driver.uart.flow_control.rts"/>
          <property id="module.driver.uart.pin_control_port" value="module.driver.uart.pin_control_port.PORT_DISABLE"/>
          <property id="module.driver.uart.pin_control_pin" value="module.driver.uart.pin_control_pin.PIN_DISABLE"/>
          <property id="module.driver.uart.clk_src" value="module.driver.uart.clk_src.int_clk"/>
          <property id="module.driver.uart.rx_edge_start" value="module.driver.uart.rx_edge_start.falling_edge"/>
          <property id="module.driver.uart.noisecancel_en" value="module.driver.uart.noisecancel_en.disabled"/>
          <property id="module.driver.uart.rx_fifo_trigger" value="module.driver.uart.rx_fifo_trigger.max"/>
          <property id="module.driver.uart.rs485.de_enable" value="module.driver.uart.rs485.de_enable.disabled"/>
          <property id="module.driver.uart.rs485.de_polarity" value="module.driver.uart.rs485.de_polarity.high"/>
          <property id="module.driver.uart.rs485.de_port_number" value="module.driver.uart.rs485.de_port_number.PORT_DISABLE"/>
          <property id="module.driver.uart.rs485.de_pin_number" value="module.driver.uart.rs485.de_pin_number.PIN_DISABLE"/>
          <property id="module.driver.uart.callback" value="user_uart_callback"/>
          <property id="module.driver.uart.rxi_ipl" value="board.icu.common.irq.priority1"/>
          <property id="module.driver.uart.txi_ipl" value="board.icu.common.irq.priority1"/>
          <property id="module.driver.uart.tei_ipl" value="board.icu.common.irq.priority1"/>
          <property id="module.driver.uart.eri_ipl" value="board.icu.common.irq.priority1"/>
        </module>
        <module id="module.driver.transfer_on_dtc.661221452">
          <property id="module.driver.transfer.name" value="g_transfer2"/>
          <property id="module.driver.transfer.mode" value="module.driver.transfer.mode.mode_normal"/>
          <property id="module.driver.transfer.size" value="module.driver.transfer.size.size_2_byte"/>
          <property id="module.driver.transfer.dest_addr_mode" value="module.driver.transfer.dest_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.src_addr_mode" value="module.driver.transfer.src_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.repeat_area" value="module.driver.transfer.repeat_area.repeat_area_source"/>
          <property id="module.driver.transfer.p_dest" value="NULL"/>
          <property id="module.driver.transfer.p_src" value="NULL"/>
          <property id="module.driver.transfer.interrupt" value="module.driver.transfer.interrupt.interrupt_end"/>
          <property id="module.driver.transfer.length" value="0"/>
          <property id="module.driver.transfer.num_blocks" value="0"/>
          <property id="module.driver.transfer.activation_source" value="_disabled"/>
        </module>
        <module id="module.driver.transfer_on_dtc.783259839">
          <property id="module.driver.transfer.name" value="g_transfer3"/>
          <property id="module.driver.transfer.mode" value="module.driver.transfer.mode.mode_normal"/>
          <property id="module.driver.transfer.size" value="module.driver.transfer.size.size_2_byte"/>
          <property id="module.driver.transfer.dest_addr_mode" value="module.driver.transfer.dest_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.src_addr_mode" value="module.driver.transfer.src_addr_mode.addr_mode_fixed"/>
          <property id="module.driver.transfer.repeat_area" value="module.driver.transfer.repeat_area.repeat_area_source"/>
          <property id="module.driver.transfer.p_dest" value="NULL"/>
          <property id="module.driver.transfer.p_src" value="NULL"/>
          <property id="module.driver.transfer.interrupt" value="module.driver.transfer.interrupt.interrupt_end"/>
          <property id="module.driver.transfer.length" value="0"/>
          <property id="module.driver.transfer.num_blocks" value="0"/>
          <property id="module.driver.transfer.activation_source" value="_disabled"/>
        </module>
        <module id="module.driver.external_irq_on_icu.1221257939">
          <property id="module.driver.external_irq.name" value="g_external_irq0"/>
          <property id="module.driver.external_irq.channel" value="1"/>
          <property id="module.driver.external_irq.trigger" value="module.driver.external_irq.trigger.trig_falling"/>
          <property id="module.driver.external_irq.filter_enable" value="module.driver.external_irq.filter_enable.false"/>
          <property id="module.driver.external_irq.pclk_div" value="module.driver.external_irq.pclk_div.pclk_div_by_64"/>
          <property id="module.driver.external_irq.p_callback" value="user_irq_callback"/>
          <property id="module.driver.external_irq.ipl" value="board.icu.common.irq.priority3"/>
        </module>
        <module id="module.driver.timer_on_gpt.516135447">
          <property id="module.driver.timer.name" value="g_ltc"/>
          <property id="module.driver.timer.channel" value="0"/>
          <property id="module.driver.timer.mode" value="module.driver.timer.mode.mode_periodic"/>
          <property id="module.driver.timer.period" value="0xEE6B2800"/>
          <property id="module.driver.timer.unit" value="module.driver.timer.unit.unit_period_usec"/>
          <property id="module.driver.timer.gtior.gtioa.initial_output_level" value="module.driver.timer.gtior.gtioa.initial_output_level.low"/>
          <property id="module.driver.timer.gtior.gtioa.cycle_end_output_level" value="module.driver.timer.gtior.gtioa.cycle_end_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtioa.compare_match_output_level" value="module.driver.timer.gtior.gtioa.compare_match_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtioa.count_stop_retain" value="module.driver.timer.gtior.gtioa.count_stop_retain.disabled"/>
          <property id="module.driver.timer.gtior.gtiob.initial_output_level" value="module.driver.timer.gtior.gtiob.initial_output_level.low"/>
          <property id="module.driver.timer.gtior.gtiob.cycle_end_output_level" value="module.driver.timer.gtior.gtiob.cycle_end_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtiob.compare_match_output_level" value="module.driver.timer.gtior.gtiob.compare_match_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtiob.count_stop_retain" value="module.driver.timer.gtior.gtiob.count_stop_retain.disabled"/>
          <property id="module.driver.timer.gtior.custom_waveform_enable" value="module.driver.timer.gtior.custom_waveform_enable.disabled"/>
          <property id="module.driver.timer.duty_cycle" value="50"/>
          <property id="module.driver.timer.gtioca_output_enabled" value="module.driver.timer.gtioca_output_enabled.false"/>
          <property id="module.driver.timer.gtioca_stop_level" value="module.driver.timer.gtioca_stop_level.pin_level_low"/>
          <property id="module.driver.timer.gtiocb_output_enabled" value="module.driver.timer.gtiocb_output_enabled.false"/>
          <property id="module.driver.timer.gtiocb_stop_level" value="module.driver.timer.gtiocb_stop_level.pin_level_low"/>
          <property id="module.driver.timer.count_up_source" value=""/>
          <property id="module.driver.timer.count_down_source" value=""/>
          <property id="module.driver.timer.start_source" value=""/>
          <property id="module.driver.timer.stop_source" value=""/>
          <property id="module.driver.timer.clear_source" value=""/>
          <property id="module.driver.timer.capture_a_source" value=""/>
          <property id="module.driver.timer.capture_b_source" value=""/>
          <property id="module.driver.timer.gtioca_filter" value="module.driver.timer.gtioc_filter.gtioc_filter_none"/>
          <property id="module.driver.timer.gtiocb_filter" value="module.driver.timer.gtioc_filter.gtioc_filter_none"/>
          <property id="module.driver.timer.p_callback" value="NULL"/>
          <property id="module.driver.timer.ipl" value="_disabled"/>
          <property id="module.driver.timer.capture_a_ipl" value="_disabled"/>
          <property id="module.driver.timer.capture_b_ipl" value="_disabled"/>
          <property id="module.driver.timer.trough_ipl" value="_disabled"/>
          <property id="module.driver.timer.extra" value="module.driver.timer.extra.disabled"/>
          <property id="module.driver.timer.poeg_link" value="module.driver.timer.poeg_link.poeg_link_poeg0"/>
          <property id="module.driver.timer.output_disable" value=""/>
          <property id="module.driver.timer.adc_trigger" value=""/>
          <property id="module.driver.timer.dead_time_count_up" value="0"/>
          <property id="module.driver.timer.dead_time_count_down" value="0"/>
          <property id="module.driver.timer.adc_a_compare_match" value="0"/>
          <property id="module.driver.timer.adc_b_compare_match" value="0"/>
          <property id="module.driver.timer.interrupt_skip.source" value="module.driver.timer.interrupt_skip.source.none"/>
          <property id="module.driver.timer.interrupt_skip.count" value="module.driver.timer.interrupt_skip.count.count_0"/>
          <property id="module.driver.timer.interrupt_skip.adc" value="module.driver.timer.interrupt_skip.adc.none"/>
          <property id="module.driver.timer.gtioca_disable_setting" value="module.driver.timer.gtioca_disable_setting.gtioc_disable_prohibited"/>
          <property id="module.driver.timer.gtiocb_disable_setting" value="module.driver.timer.gtiocb_disable_setting.gtioc_disable_prohibited"/>
        </module>
        <module id="module.driver.timer_on_gpt.5797816">
          <property id="module.driver.timer.name" value="g_pit"/>
          <property id="module.driver.timer.channel" value="1"/>
          <property id="module.driver.timer.mode" value="module.driver.timer.mode.mode_periodic"/>
          <property id="module.driver.timer.period" value="1000000"/>
          <property id="module.driver.timer.unit" value="module.driver.timer.unit.unit_period_usec"/>
          <property id="module.driver.timer.gtior.gtioa.initial_output_level" value="module.driver.timer.gtior.gtioa.initial_output_level.low"/>
          <property id="module.driver.timer.gtior.gtioa.cycle_end_output_level" value="module.driver.timer.gtior.gtioa.cycle_end_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtioa.compare_match_output_level" value="module.driver.timer.gtior.gtioa.compare_match_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtioa.count_stop_retain" value="module.driver.timer.gtior.gtioa.count_stop_retain.disabled"/>
          <property id="module.driver.timer.gtior.gtiob.initial_output_level" value="module.driver.timer.gtior.gtiob.initial_output_level.low"/>
          <property id="module.driver.timer.gtior.gtiob.cycle_end_output_level" value="module.driver.timer.gtior.gtiob.cycle_end_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtiob.compare_match_output_level" value="module.driver.timer.gtior.gtiob.compare_match_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtiob.count_stop_retain" value="module.driver.timer.gtior.gtiob.count_stop_retain.disabled"/>
          <property id="module.driver.timer.gtior.custom_waveform_enable" value="module.driver.timer.gtior.custom_waveform_enable.disabled"/>
          <property id="module.driver.timer.duty_cycle" value="50"/>
          <property id="module.driver.timer.gtioca_output_enabled" value="module.driver.timer.gtioca_output_enabled.false"/>
          <property id="module.driver.timer.gtioca_stop_level" value="module.driver.timer.gtioca_stop_level.pin_level_low"/>
          <property id="module.driver.timer.gtiocb_output_enabled" value="module.driver.timer.gtiocb_output_enabled.false"/>
          <property id="module.driver.timer.gtiocb_stop_level" value="module.driver.timer.gtiocb_stop_level.pin_level_low"/>
          <property id="module.driver.timer.count_up_source" value=""/>
          <property id="module.driver.timer.count_down_source" value=""/>
          <property id="module.driver.timer.start_source" value=""/>
          <property id="module.driver.timer.stop_source" value=""/>
          <property id="module.driver.timer.clear_source" value=""/>
          <property id="module.driver.timer.capture_a_source" value=""/>
          <property id="module.driver.timer.capture_b_source" value=""/>
          <property id="module.driver.timer.gtioca_filter" value="module.driver.timer.gtioc_filter.gtioc_filter_none"/>
          <property id="module.driver.timer.gtiocb_filter" value="module.driver.timer.gtioc_filter.gtioc_filter_none"/>
          <property id="module.driver.timer.p_callback" value="user_timer1_callback"/>
          <property id="module.driver.timer.ipl" value="board.icu.common.irq.priority2"/>
          <property id="module.driver.timer.capture_a_ipl" value="_disabled"/>
          <property id="module.driver.timer.capture_b_ipl" value="_disabled"/>
          <property id="module.driver.timer.trough_ipl" value="_disabled"/>
          <property id="module.driver.timer.extra" value="module.driver.timer.extra.disabled"/>
          <property id="module.driver.timer.poeg_link" value="module.driver.timer.poeg_link.poeg_link_poeg0"/>
          <property id="module.driver.timer.output_disable" value=""/>
          <property id="module.driver.timer.adc_trigger" value=""/>
          <property id="module.driver.timer.dead_time_count_up" value="0"/>
          <property id="module.driver.timer.dead_time_count_down" value="0"/>
          <property id="module.driver.timer.adc_a_compare_match" value="0"/>
          <property id="module.driver.timer.adc_b_compare_match" value="0"/>
          <property id="module.driver.timer.interrupt_skip.source" value="module.driver.timer.interrupt_skip.source.none"/>
          <property id="module.driver.timer.interrupt_skip.count" value="module.driver.timer.interrupt_skip.count.count_0"/>
          <property id="module.driver.timer.interrupt_skip.adc" value="module.driver.timer.interrupt_skip.adc.none"/>
          <property id="module.driver.timer.gtioca_disable_setting" value="module.driver.timer.gtioca_disable_setting.gtioc_disable_prohibited"/>
          <property id="module.driver.timer.gtiocb_disable_setting" value="module.driver.timer.gtiocb_disable_setting.gtioc_disable_prohibited"/>
        </module>
        <module id="module.driver.timer_on_gpt.1890944877">
          <property id="module.driver.timer.name" value="g_upt"/>
          <property id="module.driver.timer.channel" value="0"/>
          <property id="module.driver.timer.mode" value="module.driver.timer.mode.mode_periodic"/>
          <property id="module.driver.timer.period" value="50"/>
          <property id="module.driver.timer.unit" value="module.driver.timer.unit.unit_period_msec"/>
          <property id="module.driver.timer.gtior.gtioa.initial_output_level" value="module.driver.timer.gtior.gtioa.initial_output_level.low"/>
          <property id="module.driver.timer.gtior.gtioa.cycle_end_output_level" value="module.driver.timer.gtior.gtioa.cycle_end_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtioa.compare_match_output_level" value="module.driver.timer.gtior.gtioa.compare_match_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtioa.count_stop_retain" value="module.driver.timer.gtior.gtioa.count_stop_retain.disabled"/>
          <property id="module.driver.timer.gtior.gtiob.initial_output_level" value="module.driver.timer.gtior.gtiob.initial_output_level.low"/>
          <property id="module.driver.timer.gtior.gtiob.cycle_end_output_level" value="module.driver.timer.gtior.gtiob.cycle_end_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtiob.compare_match_output_level" value="module.driver.timer.gtior.gtiob.compare_match_output_level.retain"/>
          <property id="module.driver.timer.gtior.gtiob.count_stop_retain" value="module.driver.timer.gtior.gtiob.count_stop_retain.disabled"/>
          <property id="module.driver.timer.gtior.custom_waveform_enable" value="module.driver.timer.gtior.custom_waveform_enable.disabled"/>
          <property id="module.driver.timer.duty_cycle" value="50"/>
          <property id="module.driver.timer.gtioca_output_enabled" value="module.driver.timer.gtioca_output_enabled.false"/>
          <property id="module.driver.timer.gtioca_stop_level" value="module.driver.timer.gtioca_stop_level.pin_level_low"/>
          <property id="module.driver.timer.gtiocb_output_enabled" value="module.driver.timer.gtiocb_output_enabled.false"/>
          <property id="module.driver.timer.gtiocb_stop_level" value="module.driver.timer.gtiocb_stop_level.pin_level_low"/>
          <property id="module.driver.timer.count_up_source" value=""/>
          <property id="module.driver.timer.count_down_source" value=""/>
          <property id="module.driver.timer.start_source" value=""/>
          <property id="module.driver.timer.stop_source" value=""/>
          <property id="module.driver.timer.clear_source" value=""/>
          <property id="module.driver.timer.capture_a_source" value=""/>
          <property id="module.driver.timer.capture_b_source" value=""/>
          <property id="module.driver.timer.gtioca_filter" value="module.driver.timer.gtioc_filter.gtioc_filter_none"/>
          <property id="module.driver.timer.gtiocb_filter" value="module.driver.timer.gtioc_filter.gtioc_filter_none"/>
          <property id="module.driver.timer.p_callback" value="usb_poll_callback"/>
          <property id="module.driver.timer.ipl" value="board.icu.common.irq.priority4"/>
          <property id="module.driver.timer.capture_a_ipl" value="_disabled"/>
          <property id="module.driver.timer.capture_b_ipl" value="_disabled"/>
          <property id="module.driver.timer.trough_ipl" value="_disabled"/>
          <property id="module.driver.timer.extra" value="module.driver.timer.extra.disabled"/>
          <property id="module.driver.timer.poeg_link" value="module.driver.timer.poeg_link.poeg_link_poeg0"/>
          <property id="module.driver.timer.output_disable" value=""/>
          <property id="module.driver.timer.adc_trigger" value=""/>
          <property id="module.driver.timer.dead_time_count_up" value="0"/>
          <property id="module.driver.timer.dead_time_count_down" value="0"/>
          <property id="module.driver.timer.adc_a_compare_match" value="0"/>
          <property id="module.driver.timer.adc_b_compare_match" value="0"/>
          <property id="module.driver.timer.interrupt_skip.source" value="module.driver.timer.interrupt_skip.source.none"/>
          <property id="module.driver.timer.interrupt_skip.count" value="module.driver.timer.interrupt_skip.count.count_0"/>
          <property id="module.driver.timer.interrupt_skip.adc" value="module.driver.timer.interrupt_skip.adc.none"/>
          <property id="module.driver.timer.gtioca_disable_setting" value="module.driver.timer.gtioca_disable_setting.gtioc_disable_prohibited"/>
          <property id="module.driver.timer.gtiocb_disable_setting" value="module.driver.timer.gtiocb_disable_setting.gtioc_disable_prohibited"/>
        </module>
        <module id="module.driver.pvnd_on_usb.1824498731">
          <property id="module.driver.pvnd.name" value="g_pvnd0"/>
        </module>
        <module id="module.driver.basic_on_usb.679197675">
          <property id="module.driver.basic.name" value="g_basic0"/>
          <property id="module.driver.usb_basic.usb_mode" value="module.driver.usb_basic.usb_mode.host"/>
          <property id="module.driver.usb_basic.usb_speed" value="module.driver.usb_basic.usb_speed.fs"/>
          <property id="module.driver.usb_basic.usb_modulenumber" value="module.driver.usb_basic.usb_modulenumber.0"/>
          <property id="module.driver.usb_basic.usb_classtype" value="module.driver.usb_basic.usb_classtype.pcdc"/>
          <property id="module.driver.usb_basic.p_usb_reg" value="g_usb_descriptor"/>
          <property id="module.driver.usb_basic.complience_cb" value="NULL"/>
          <property id="module.driver.usb_basic.ipl" value="board.icu.common.irq.priority3"/>
          <property id="module.driver.usb_basic.ipl_r" value="board.icu.common.irq.priority3"/>
          <property id="module.driver.usb_basic.ipl_d0" value="board.icu.common.irq.priority3"/>
          <property id="module.driver.usb_basic.ipl_d1" value="board.icu.common.irq.priority3"/>
          <property id="module.driver.usb_basic.hsipl" value="_disabled"/>
          <property id="module.driver.usb_basic.hsipl_d0" value="_disabled"/>
          <property id="module.driver.usb_basic.hsipl_d1" value="_disabled"/>
          <property id="module.driver.usb_basic.rtos_callback" value="NULL"/>
          <property id="module.driver.usb_basic.other_context" value="NULL"/>
        </module>
        <context id="_hal.0">
          <stack module="module.driver.ioport_on_ioport.0"/>
          <stack module="module.driver.spi_on_spi.2086473694">
            <stack module="module.driver.transfer_on_dtc.1054883147" requires="module.driver.spi_on_spi.requires.transfer_tx"/>
            <stack module="module.driver.transfer_on_dtc.1007961353" requires="module.driver.spi_on_spi.requires.transfer_rx"/>
          </stack>
          <stack module="module.driver.uart_on_sci_uart.1639526852">
            <stack module="module.driver.transfer_on_dtc.661221452" requires="module.driver.uart_on_sci_uart.requires.transfer_tx"/>
            <stack module="module.driver.transfer_on_dtc.783259839" requires="module.driver.uart_on_sci_uart.requires.transfer_rx"/>
          </stack>
          <stack module="module.driver.external_irq_on_icu.1221257939"/>
          <stack module="module.driver.timer_on_gpt.516135447"/>
          <stack module="module.driver.timer_on_gpt.5797816"/>
          <stack module="module.driver.timer_on_gpt.1890944877"/>
          <stack module="module.driver.pvnd_on_usb.1824498731">
            <stack module="module.driver.basic_on_usb.679197675" requires="module.driver.basic_on_usb.requires.basic"/>
          </stack>
        </context>
        <config id="config.driver.ioport">
          <property id="config.driver.ioport.checking" value="config.driver.ioport.checking.system"/>
        </config>
        <config id="config.driver.icu">
          <property id="config.driver.icu.param_checking_enable" value="config.driver.icu.param_checking_enable.bsp"/>
        </config>
        <config id="config.driver.usb_basic">
          <property id="config.driver.usb_basic.param_checking_enable" value="config.driver.usb_basic.param_checking_enable.bsp"/>
          <property id="config.driver.usb_basic.pll_clock_frequency" value="config.driver.usb_basic.pll_clock_frequency.24mhz"/>
          <property id="config.driver.usb_basic.buswait" value="config.driver.usb_basic.buswait.0"/>
          <property id="config.driver.usb_basic.bc_function" value="config.driver.usb_basic.bc_function.disable"/>
          <property id="config.driver.usb_basic.power_source" value="config.driver.usb_basic.power_source.high"/>
          <property id="config.driver.usb_basic.dcp_function" value="config.driver.usb_basic.dcp_function.disable"/>
          <property id="config.driver.usb_basic.request" value="config.driver.usb_basic.request.enable"/>
          <property id="config.driver.usb_basic.dblb" value="config.driver.usb_basic.dblb.enable"/>
          <property id="config.driver.usb_basic.cntmd" value="config.driver.usb_basic.cntmd.disable"/>
          <property id="config.driver.usb_basic.ldo_regulator" value="config.driver.usb_basic.ldo_regulator.disable"/>
          <property id="config.driver.usb_basic.dma" value="config.driver.usb_basic.dma.disable"/>
          <property id="config.driver.usb_basic.source_address" value="config.driver.usb_basic.source_address.none"/>
          <property id="config.driver.usb_basic.dest_address" value="config.driver.usb_basic.dest_address.none"/>
          <property id="config.driver.usb_basic.compliance_mode" value="config.driver.usb_basic.compliance_mode.disable"/>
          <property id="config.driver.usb_basic.tpl_table" value="NULL"/>
        </config>
        <config id="config.driver.dtc">
          <property id="config.driver.dtc.param_checking_enable" value="config.driver.dtc.param_checking_enable.bsp"/>
          <property id="config.driver.dtc.vector_table" value=".fsp_dtc_vector_table"/>
        </config>
        <config id="config.driver.sci_uart">
          <property id="config.driver.sci_uart.param_checking_enable" value="config.driver.sci_uart.param_checking_enable.bsp"/>
          <property id="config.driver.sci_uart.fifo_support" value="config.driver.sci_uart.fifo_support.enabled"/>
          <property id="config.driver.sci_uart.dtc_support" value="config.driver.sci_uart.dtc_support.enabled"/>
          <property id="config.driver.sci_uart.flow_control" value="config.driver.sci_uart.flow_control.disabled"/>
          <property id="config.driver.sci_uart.rs485" value="config.driver.sci_uart.rs485.disabled"/>
        </config>
        <config id="config.driver.gpt">
          <property id="config.driver.gpt.param_checking_enable" value="config.driver.gpt.param_checking_enable.bsp"/>
          <property id="config.driver.gpt.output_support_enable" value="config.driver.gpt.output_support_enable.disabled"/>
          <property id="config.driver.gpt.write_protect_enable" value="config.driver.gpt.write_protect_enable.disabled"/>
          <property id="config.driver.gpt.gpt_core_clock" value="module.driver.timer.gpt_core_clock.pclk"/>
        </config>
        <config id="config.driver.spi">
          <property id="config.driver.spi.param_checking_enable" value="config.driver.spi.param_checking_enable.bsp"/>
          <property id="config.driver.spi.dtc_enable" value="config.driver.spi.dtc_enable.enabled"/>
          <property id="config.driver.spi.rxi_transmit" value="config.driver.spi.rxi_transmit.disabled"/>
        </config>
      </raModuleConfiguration>
      <raPinConfiguration>
        <pincfg active="true" name="R7FA4M2AD3CFL.pincfg" selected="true" symbol="g_bsp_pin_cfg">
          <configSetting altId="debug0.mode.swd" configurationId="debug0.mode"/>
          <configSetting altId="debug0.swclk.p300" configurationId="debug0.swclk"/>
          <configSetting altId="debug0.swdio.p108" configurationId="debug0.swdio"/>
          <configSetting altId="irq0.irq01.p104" configurationId="irq0.irq01"/>
          <configSetting altId="irq0.mode.enabled" configurationId="irq0.mode"/>
          <configSetting altId="p000.output.low" configurationId="p000"/>
          <configSetting altId="p000.gpio_mode.gpio_mode_out.low" configurationId="p000.gpio_mode"/>
          <configSetting altId="p001.output.low" configurationId="p001"/>
          <configSetting altId="p001.gpio_mode.gpio_mode_out.low" configurationId="p001.gpio_mode"/>
          <configSetting altId="p013.output.low" configurationId="p013"/>
          <configSetting altId="p013.gpio_mode.gpio_mode_out.low" configurationId="p013.gpio_mode"/>
          <configSetting altId="p014.output.low" configurationId="p014"/>
          <configSetting altId="p014.gpio_mode.gpio_mode_out.low" configurationId="p014.gpio_mode"/>
          <configSetting altId="p100.sci0.rxd" configurationId="p100"/>
          <configSetting altId="p100.gpio_mode.gpio_mode_peripheral" configurationId="p100.gpio_mode"/>
          <configSetting altId="p101.sci0.txd" configurationId="p101"/>
          <configSetting altId="p101.gpio_mode.gpio_mode_peripheral" configurationId="p101.gpio_mode"/>
          <configSetting altId="p104.irq0.irq01" configurationId="p104"/>
          <configSetting altId="p104.gpio_irq.gpio_irq_enabled" configurationId="p104.gpio_irq"/>
          <configSetting altId="p104.gpio_mode.gpio_mode_irq" configurationId="p104.gpio_mode"/>
          <configSetting altId="p104.gpio_pupd.gpio_pupd_ip_up" configurationId="p104.gpio_pupd"/>
          <configSetting altId="p108.debug0.swdio" configurationId="p108"/>
          <configSetting altId="p108.gpio_mode.gpio_mode_peripheral" configurationId="p108.gpio_mode"/>
          <configSetting altId="p109.spi0.mosi" configurationId="p109"/>
          <configSetting altId="p109.gpio_mode.gpio_mode_peripheral" configurationId="p109.gpio_mode"/>
          <configSetting altId="p110.spi0.miso" configurationId="p110"/>
          <configSetting altId="p110.gpio_mode.gpio_mode_peripheral" configurationId="p110.gpio_mode"/>
          <configSetting altId="p111.spi0.rspck" configurationId="p111"/>
          <configSetting altId="p111.gpio_mode.gpio_mode_peripheral" configurationId="p111.gpio_mode"/>
          <configSetting altId="p112.output.high" configurationId="p112"/>
          <configSetting altId="p112.gpio_speed.gpio_speed_high" configurationId="p112.gpio_drivecapacity"/>
          <configSetting altId="p112.gpio_mode.gpio_mode_out.high" configurationId="p112.gpio_mode"/>
          <configSetting altId="p206.output.low" configurationId="p206"/>
          <configSetting altId="p206.gpio_mode.gpio_mode_out.low" configurationId="p206.gpio_mode"/>
          <configSetting altId="p300.debug0.swclk" configurationId="p300"/>
          <configSetting altId="p300.gpio_mode.gpio_mode_peripheral" configurationId="p300.gpio_mode"/>
          <configSetting altId="p407.usbfs0.vbus" configurationId="p407"/>
          <configSetting altId="p407.gpio_mode.gpio_mode_peripheral" configurationId="p407.gpio_mode"/>
          <configSetting altId="sci0.mode.asynchronous.free" configurationId="sci0.mode"/>
          <configSetting altId="sci0.rxd.p100" configurationId="sci0.rxd"/>
          <configSetting altId="sci0.txd.p101" configurationId="sci0.txd"/>
          <configSetting altId="spi0.miso.p110" configurationId="spi0.miso"/>
          <configSetting altId="spi0.mode.enabled.free" configurationId="spi0.mode"/>
          <configSetting altId="spi0.mosi.p109" configurationId="spi0.mosi"/>
          <configSetting altId="spi0.pairing.free" configurationId="spi0.pairing"/>
          <configSetting altId="spi0.rspck.p111" configurationId="spi0.rspck"/>
          <configSetting altId="usbfs0.mode.device" configurationId="usbfs0.mode"/>
          <configSetting altId="usbfs0.vbus.p407" configurationId="usbfs0.vbus"/>
        </pincfg>
      </raPinConfiguration>
    </raConfiguration>
    

  • Hello again,

    I assume that you have changed also the code from usb_pcdc example since these APIs are used for usb_pvnd  

    Could you also share your code with us?

    Thank you!

    Best Regards,

    IK

  • Hi,

    Yes, here's the "manual" part of the code. It does indeed use the PipeRead/PipeWrite functions.

    #define APP_ERR_TRAP(err)        if(err) {\
            SEGGER_RTT_printf(SEGGER_INDEX, "\r\nReturned Error Code: 0x%x  \r\n", err);\
            __asm("BKPT #0\n");} /* trap upon the error  */
            
    
    void process_usb_event(void)
    {
    	fsp_err_t err = FSP_SUCCESS;
    	usb_event_info_t event_info = {0};
    	usb_status_t usb_event;
    
    //	static uint8_t wBuf[6] = {'H', 'i', '\n'};
    //	static uint32_t cnt = 0;
    //	if (++cnt > 200)
    //	{
    //		cnt = 0;
    //		err = R_USB_PipeWrite(&g_basic0_ctrl, wBuf, 3u, bulk_in_pipe);
    //		//APP_ERR_TRAP(err);
    //	}
    
    	//TODO: process all pending events (loop until some return value?)
    	err = R_USB_EventGet(&event_info, &usb_event);
    	APP_ERR_TRAP(err);
    
    	/* Early return if there is no event to process */
    	if (usb_event == USB_STATUS_NONE) return;
    
    	/* USB event received by R_USB_EventGet */
    	switch (usb_event)
        {
            case USB_STATUS_CONFIGURED:
            {
                /* Process USB configured event */
                err = usb_configured_event_process();
                APP_ERR_TRAP(err);
                break;
            }
    
            case USB_STATUS_READ_COMPLETE:
            {
                /* check for out pipe */
                if ((p_usb_event->pipe == bulk_out_pipe) && (p_usb_event->status != FSP_ERR_USB_FAILED))
                {
                	// TODO: get read data
                }
                break;
            }
    
            case USB_STATUS_WRITE_COMPLETE:
            {
                /* check for in pipe */
                if ((p_usb_event->pipe == bulk_in_pipe) && (p_usb_event->status != FSP_ERR_USB_FAILED))
                {
                    if (USB_APL_MXPS == max_packet_size)
                    {
                        /* Send ZLP */
                        err = R_USB_PipeWrite(&g_basic0_ctrl, NULL, 0, p_usb_event->pipe);
                        APP_ERR_TRAP(err);
                    }
                }
                break;
            }
    
            case USB_STATUS_REQUEST:
            {
                /* process USB status request event */
                err = usb_status_request();
                APP_ERR_TRAP(err);
                break;
            }
    
            case USB_STATUS_REQUEST_COMPLETE:
            {
                if (USB_GET_VENDOR == (p_usb_event->setup.request_type & USB_BREQUEST))
                {
                    /* Start reading data */
                    err = R_USB_PipeRead(&g_basic0_ctrl, g_buf, (BUF_SIZE), bulk_out_pipe);
                    APP_ERR_TRAP(err);
                }
                break;
            }
    
            case USB_STATUS_DETACH:
            {
                APP_PRINT("\nUSB STATUS : USB_STATUS_DETACH\r\n");
                break;
            }
            case USB_STATUS_SUSPEND:
            {
                APP_PRINT("\nUSB STATUS : USB_STATUS_SUSPEND\r\n");
                break;
            }
            case USB_STATUS_RESUME:
            {
                APP_PRINT("\nUSB STATUS : USB_STATUS_RESUME\r\n");
                break;
            }
            default:
            {
                break;
            }
        }
    }
    
    /*******************************************************************************************************************//**
     * @brief     Function processes USB configured event.
     * @param[IN] None
     * @retval    Any Other Error code apart from FSP_SUCCESS on Unsuccessful operation.
     **********************************************************************************************************************/
    static fsp_err_t usb_configured_event_process(void)
    {
        fsp_err_t err        = FSP_SUCCESS;
        uint16_t used_pipe   = RESET_VALUE;
        usb_pipe_t pipe_info = {RESET_VALUE};
    
        APP_PRINT("USB Configured Successfully\r\n");
    
        /* Get USB Pipe Information */
        err = R_USB_UsedPipesGet(&g_basic0_ctrl, &used_pipe, USB_CLASS_PVND);
        if (FSP_SUCCESS != err)
        {
            APP_ERR_PRINT("\r\nR_USB_UsedPipesGet failed\r\n");
        }
        else
        {
            for (uint8_t pipe = START_PIPE; pipe < END_PIPE; pipe++)
            {
                /* check for the used pipe */
                if ((used_pipe & (START_PIPE << pipe)) != RESET_VALUE)
                {
                    /* Get the pipe Info */
                    err = R_USB_PipeInfoGet(&g_basic0_ctrl, &pipe_info, (uint8_t)pipe);
    
                    APP_PRINT("\r\nBulkPiPe: %d Pipe Number: %d", pipe_info.transfer_type, pipe);
    
                    if (USB_EP_DIR_IN != (pipe_info.endpoint & USB_EP_DIR_IN))
                    {
                        /* Out Transfer */
                        if (USB_TRANSFER_TYPE_BULK == pipe_info.transfer_type)
                        {
                            bulk_out_pipe = pipe;
                        }
                        else
                        {
                            int_out_pipe = pipe;
                        }
                    }
                    else
                    {
                        /* In Transfer */
                        if (USB_TRANSFER_TYPE_BULK == pipe_info.transfer_type)
                        {
                            bulk_in_pipe = pipe;
                        }
                        else
                        {
                        	int_in_pipe = pipe;
                        }
                    }
    
                    //TODO: also map int pipes
                }
                else
                {
                    /* Do nothing */
                }
            }
            APP_DBG_PRINT("\r\nAll pipe info is fetched from USB Vendor Peripheral driver\r\n");
        }
        return err;
    }
    
    /*******************************************************************************************************************//**
     * @brief     Function processes USB status complete request event.
     * @param[IN] None
     * @retval    Any Other Error code apart from FSP_SUCCESS on Unsuccessful operation.
     **********************************************************************************************************************/
    static fsp_err_t usb_status_request(void)
    {
        fsp_err_t err     = FSP_SUCCESS;
        uint16_t request_length = 0;
        if (USB_SET_VENDOR_NO_DATA == (p_usb_event->setup.request_type & USB_BREQUEST))
        {
            /* Set ACk to host */
            err = R_USB_PeriControlStatusSet(&g_basic0_ctrl, USB_SETUP_STATUS_ACK);
            APP_ERR_TRAP(err);
        }
        else if (USB_SET_VENDOR == (p_usb_event->setup.request_type & USB_BREQUEST))
        {
            request_length = p_usb_event->setup.request_length;
            /* Get data length from host */
            err = R_USB_PeriControlDataGet(&g_basic0_ctrl, g_request_buf, request_length);
            APP_ERR_TRAP(err);
        }
        else if (USB_GET_VENDOR == (p_usb_event->setup.request_type & USB_BREQUEST))
        {
            /* Set data length in peripheral */
            err = R_USB_PeriControlDataSet(&g_basic0_ctrl, g_request_buf, 0);
            APP_ERR_TRAP(err);
        }
        else
        {
            /* Unsupported request */
        }
        return err;
    }

    I am trying to get a minimalistic concept running, just initializing USB and then running "process_usb_event" in an infinite loop. The fact that USB device is correctly recognized tells me the problem is not in Init, so I didn't include that part. The Read part is not implemented, because the READ/WRITE switch cases are not even hit so far.

    I am trying to make it as similar to the PCDC demo as possible. Maybe it's easier if you can confirm the following:

    1. Is PVND driver designed to work correctly in non-RTOS mode ? I found a non-RTOS example for PCDC, but not for PVND, that's why I'm asking

    2. Does the PVND setup need different FSP config than the PCDC ? Does it need any additional or different function calls (other than the PileRead/PipeWrite change?)

    3. ZLP packet logic should not be a blocker, because the issue appears even when first reading from USB, and ZLP packet is not relevant in this case, correct ?

    4. Any suggestion where to put breakpoints and check data or control flow ?

    5. Do you by any chance already have a non-RTOS PVND example code ?

    Thanks!

  • Hello,

    Apologies for the delay!

    Unfortunately we do not have an non RTOS example with usb_pvnd, there is only an RTOS example which is using 2 different RA MCU device. The one device runs usb_pvnd example and the other is running usb_hvnd example. The driver can be used and with no RTOS projects.

    I would suggest to you to take a look on the documentation provided for usb_pvnd module of FSP. 

    There is also an example of code here which shows how to use it with RTOS and no RTOS. Please check the link below:

    https://renesas.github.io/fsp/group___u_s_b___p_v_n_d.html

    Hope it helps!

    Best Regards,

    IK

  • Thank you for the suggestions. I changed my test procedure and by luck I managed to detect some USB activity.

    Reads and writes somehow work, but not as expected. I don't get any USB_STATUS_READ_COMPLETE event from R_USB_EventGet function when there is new data in the pipe. But it works if I periodically call the PipeRead. Most of the time it'll return an error, but when there is data, it returns it correctly.

    Is it meant to be like this for PVND ? Do I have to use another function to check if there is incoming data ?

    I should mention I am using 2 pipes, both configured on EP1 (IN and OUT) in bulk mode. Could this be a problem ?

    -LATER EDIT- it seems that I was using the read/write functions wrong. I need to call read in order to listen for new data, not after the data is received. This solved it.

    Best regards,

    Alin

Reply
  • Thank you for the suggestions. I changed my test procedure and by luck I managed to detect some USB activity.

    Reads and writes somehow work, but not as expected. I don't get any USB_STATUS_READ_COMPLETE event from R_USB_EventGet function when there is new data in the pipe. But it works if I periodically call the PipeRead. Most of the time it'll return an error, but when there is data, it returns it correctly.

    Is it meant to be like this for PVND ? Do I have to use another function to check if there is incoming data ?

    I should mention I am using 2 pipes, both configured on EP1 (IN and OUT) in bulk mode. Could this be a problem ?

    -LATER EDIT- it seems that I was using the read/write functions wrong. I need to call read in order to listen for new data, not after the data is received. This solved it.

    Best regards,

    Alin

Children
No Data