riscv-mcu / GD32VF103_Firmware_Library

Original GD32VF103 Firmware Library
128 stars 37 forks source link

Compiling the USB CDC_ACM example for longan nano #4

Closed Martoni closed 4 years ago

Martoni commented 4 years ago

Does somebody managed to compile the USB CDC_ACM example for longan nano ? I saw on sipeed forum that some people tryied it without success.

Personnally I can't manage to compile it with platformio. I have problems with macro __packed.

Then, is these repository examples been tested with the longan nano ?

Phil242 commented 4 years ago

Hi,

Same problem here.

Won't compile and then won't link stage for sure doesn't found any .o or reference file. This is related to this problem: https://github.com/sipeed/platform-gd32v/issues/14 Hope a solution will be found.

Cheers,

yesitsme007 commented 4 years ago

With some tweaks i was able to compile this sample. But the code is not working on the Longan. In file drv_usb_core.c there is a function usb_core_reset():

static void usb_core_reset (usb_core_regs *usb_regs)
{
    /* enable core soft reset */
    usb_regs->gr->GRSTCTL |= GRSTCTL_CSRST;

    /* wait for the core to be soft reset */
    while (usb_regs->gr->GRSTCTL & GRSTCTL_CSRST);

    /* wait for addtional 3 PHY clocks */
    usb_udelay(3);
}

The while() loop never terminates, this flag never gets reset.

Is this code supposed to work on the Longan?

Martoni commented 4 years ago

Any news for this problem ?

Martoni commented 4 years ago

Solved ! With this project : https://github.com/linusreM/GD32V-Virtual-COM-Port