• AVR Freaks

Hot!Developing CDC USB device on PIC32mx250F128B

New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/04/01 20:54:23
  • Location: 0
  • Status: offline
2020/02/11 12:28:51 (permalink)

Developing CDC USB device on PIC32mx250F128B

Good day, i am new to the USB module, i have been trying to port the CDC serial emulator on the microchip MLA. i am still trying to just compile it without changing the settings to that of the PIC32mx250F128B.
i encounter these errors, i have double the includes folders also.
usb_device.c:321:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'BDT_BASE_ADDR_TAG'
usb_device.c:326:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CTRL_TRF_SETUP_ADDR_TAG'

usb_device.c:327:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CTRL_TRF_DATA_ADDR_TAG'

usb_device.c: In function 'USBDeviceInit':
if anyone can point me in the right direction would really appreciate it. THanks in advance

1 Reply Related Threads

    Starting Member
    • Total Posts : 37
    • Reward points : 0
    • Joined: 2017/04/08 12:17:32
    • Location: 0
    • Status: offline
    Re: Developing CDC USB device on PIC32mx250F128B 2020/02/27 02:52:09 (permalink)
    Working with the PIC32MX795F512L I have tried many of microchips USB demos and codes. MLA, MAL and Harmony, all did not work and contained a lot of unreadable code. In the end I adapted a USB stack from someone else (originally for PIC32MM).
    If you are able to have your code in C++, I would recommend taking a look at this: https://github.com/memen45/PIC32MX_CPP
    The USB module for your device is the same (except for maybe some details, I have not looked into your specific datasheet, but the family reference for the USB module is the same). Things you would have to check/adapt to your device:
    - Usb.cpp register addresses and bit locations might not be the same for your device
    - Irq.hpp irq_nr (enum) and vector numbers (lookup table) might not be the same for your device
    - Irq.cpp register addresses might not be the same for your device
    - Irq_isr.cpp remove isrs you do not need, add the ones you need, USB isr is listed already here
    The cdc example in there should give an idea on how to use it, very short version:
    #include "Usb/UsbCdcAcm.hpp"
    UsbCdcAcm cdc;
    Delay::wait(5_sec); // not necessary to wait this long
    if (cdc.is_active()) cdc.printf("Hi from USB cdc");

    Best regards
    post edited by Memen - 2020/02/27 02:54:16
    Jump to:
    © 2020 APG vNext Commercial Version 4.5