Hi,

Thank you for your response.

USB works on my board, I tested it with code generated by: STM32CubeMX.
STM32CubeMX generates only one USB interface code, and it is not
possible use few USB interfaces;-/
That is why I'm trying use libopenmc3:)

I reused settings from STM32CubeMX rcc tab, and I've got, something like:

const struct rcc_clock_scale rcc_cs_96 = {
    .pllm = 8,
    .plln = 192,
    .pllp = 2,
    .pllq = 4,
    .pllr = 0,
    .flash_config = FLASH_ACR_DCEN | FLASH_ACR_ICEN | FLASH_ACR_LATENCY_3WS,
    .hpre = RCC_CFGR_HPRE_DIV_NONE,
    .ppre1 = RCC_CFGR_PPRE_DIV_4,
    .ppre2 = RCC_CFGR_PPRE_DIV_2,
    .power_save = 1,
    .ahb_frequency  = 96000000,
    .apb1_frequency = 48000000,
    .apb2_frequency = 96000000,
};

Main code is:

int main(void)
{
    rcc_clock_setup_hse_3v3(&rcc_cs_96);
    rcc_periph_clock_enable(RCC_GPIOA);
    rcc_periph_clock_enable(RCC_OTGFS);

    gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9 |
GPIO11 | GPIO12);
    gpio_set_af(GPIOA, GPIO_AF10, GPIO9 | GPIO11 | GPIO12);

    usbd_device *usbd_dev = usbd_init(
            &otgfs_usb_driver, &dev, &config,
            usb_strings, 3,
            usbd_control_buffer, sizeof(usbd_control_buffer)
    );
    usbd_register_set_config_callback(usbd_dev, cdcacm_set_config);
    while (1) {
        usbd_poll(usbd_dev);
    }
}

My input HSE crystal is 8MHz.

Still doesn't work... But also trying get to work that...

Thanks
Zygmunt

2017-11-27 21:46 GMT+01:00 Karl Palsson <ka...@tweak.net.au>:
>
> F411 simply didn't exist when those examples were written.
>
> As far as I can tell, you should be using the ogffs_usb_driver,
> and you'll probably have to do some things to configure your RCC
> clocks properly, I imagine there may have been some changes, but
> a cursory check over RM0383 seems to the same as rm0090 for most
> purposes I can tell.
>
> You should definitely follow Chuck's advice and check that you
> have the right GPIOs connected, and set to the right modes.
>
> You should check that your dev board has a suitable crystal and
> that you are using it in your clock configuration.
>
> You should not have to edit the driver or make a new driver at
> all.
>
>
> Chuck McManis <chuck.mcma...@gmail.com> wrote:
>> There are four things that must be correct for USB to work 1)
>> You must set the proper USB peripheral (FS, HS, OTG) and have
>> the appropriate code for that peripheral 2) You must set the
>> proper I/O pins (enable the clocks, set their alternate
>> function) 3) You must enable the clocks for both the GPIO ports
>> where the pins are, and the USB peripheral you are using 4) You
>> must call usb_poll() often enough for it to service any
>> requests coming from the host.
>>
>> I recommend that you read through the USB section of the
>> Reference Manual (RM0383 :
>> http://www.st.com/resource/en/reference_manual/dm00119316.pdf).
>>
>> --Chuck
>>
>>
>> On Mon, Nov 27, 2017 at 6:50 AM, Zygmunt Ptak
>> <zygmuntp...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I have a dev platform based on stm32f411ce.
>> >
>> > I'm trying to get working USB, but I doesn't work.
>> > I copied code from f4 examples (my build for blinking LED example
>> > works), but somehow USB is dead.
>> >
>> > I don't see any USB example for stm32f411re or near.
>> > Is there some reason why example is not implemented for stm32f411re?
>> >
>> > Do I have to implement driver?
>> > I tried both: otgfs_usb_driver, otghs_usb_driver. Other are not
>> > included in build.
>> >
>> > What I have to do to get USB on my stm32f411ce?
>> >
>> > Best Regards
>> > Zygmunt Ptak
>> >
>> > ------------------------------------------------------------
>> > ------------------
>> > Check out the vibrant tech community on one of the world's most
>> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> > _______________________________________________
>> > libopencm3-devel mailing list
>> > libopencm3-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
>> >
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org!
>> http://sdm.link/slashdot_______________________________________________
>> libopencm3-devel mailing list
>> libopencm3-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to