Author Topic: Minimal USB CDC for PIC32...Update: Say goodbye to COM ports  (Read 8969 times)

0 Members and 2 Guests are viewing this topic.

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Minimal USB CDC for PIC32...Update: Say goodbye to COM ports
« Reply #25 on: April 30, 2021, 09:15:02 pm »
I've done a couple of projects with PIC32MM. Quite a nice cheap entry level 32-bit device family, must always check errata though.

would have become my goto if not for the ADC errata. Crazy cheap and good performance with USB. why would anyone use a M0+ is besides me. (unless for the ADC errata :( )
 

Offline orphean

  • Supporter
  • ****
  • Posts: 1
  • Country: us
Re: Minimal USB CDC for PIC32...Update: Say goodbye to COM ports
« Reply #26 on: May 02, 2021, 11:05:03 pm »
I've done a couple of projects with PIC32MM. Quite a nice cheap entry level 32-bit device family, must always check errata though.

would have become my goto if not for the ADC errata. Crazy cheap and good performance with USB. why would anyone use a M0+ is besides me. (unless for the ADC errata :( )

Code: [Select]
ADC 12-Bit Conversion The ADC may miss one or more of the following codes in 12-bit mode: 1023, 2046, 2047, 3070 and 3071.

ADC Format Options 32-bit signed format option is the same as the 16-bit signed format option.

These seem to be the remaining ADC errata as of revision A4.  Would you mind sharing what makes these a deal breaker for you?  I've been evaluating the pic32mm with a usb dev board and just curious what your thoughts are, thanks!
 

Offline voltsandjoltsTopic starter

  • Supporter
  • ****
  • Posts: 2300
  • Country: gb
Re: Minimal USB CDC for PIC32...Update: Say goodbye to COM ports
« Reply #27 on: May 03, 2021, 03:35:39 pm »
Different applications have different requirements.
For many applications a few missing ADC codes would not be an issue, but yeh, it's not ideal.
Peruse the errata and datasheet then you can decide if it meets your application requirements.

With Microchip parts its often worth reading the errata first :P
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Minimal USB CDC for PIC32...Update: Say goodbye to COM ports
« Reply #28 on: February 27, 2023, 03:16:03 pm »
These seem to be the remaining ADC errata as of revision A4.  Would you mind sharing what makes these a deal breaker for you?  I've been evaluating the pic32mm with a usb dev board and just curious what your thoughts are, thanks!

Simply put, i require the 12bit resolution. In the meantime, my goto has become the PIC24FJ GU series (specifically the parts in the 40x sub family)


With Microchip parts its often worth reading the errata first :P

with all parts, read the errata first  :blah: no errata available, you're in for a bad time..
almost two years later, i finally had to work on a new usb gadget for which HID wouldn't cut it, thanks to your pointers earlier i managed to make windows enumerate the device without a driver.
It's actually easier than i thought.

Taking the "USB Device - Vendor Throughput Test" in the MLA as an example, one just have to remove the GUID part from the extended property windows descriptor.
Code: [Select]
    const MS_EXT_PROPERTY_FEATURE_DESC ExtPropertyFeatureDescriptor =
    {
        //----------Header Section--------------
        sizeof(ExtPropertyFeatureDescriptor),   //dwLength
        0x0100,                                 //bcdVersion = 1.00
        EXTENDED_PROPERTIES,                    //wIndex
        0x0000,                                 //wCount
    };   

Assign a new PID, the device will enumerate.

In case one doesn't want to use MCC and keep using the MLA code (it's actually exactly the same but i don't want to use that slow useless plugin) with the PIC24FJ GU series, this is the code to initialize the FRC for active clock tuning - no crystal requried
Code: [Select]
//Set up PLL - PLL parameters are already set in hardware
  CLKDIVbits.RCDIV = 1;   //FRC divided dy 1:2
  CLKDIVbits.CPDIV = 0;   //PLL Output Divide by 1:1
  CLKDIVbits.PLLEN = 1;   //PLL always enabled
  __builtin_write_OSCCONH(0x01);
  __builtin_write_OSCCONL(0x01);
  while(!OSCCONbits.LOCK);

  //Enable Active Clock Tuning
  OSCTUNbits.STSRC = 1;   //Tuning Soruce is USB
  OSCTUNbits.STEN = 1;    //Enable Active Clock Tuning

and in order to use the MLA one has to add these lines in the usb_hal_pic24f.h file, in the IFDEF block that selects the processor type (i only added one of the chips, the rest is left as an exercise to the reader)
Code: [Select]
#elif defined(__PIC24FJ256GU406__)
    #define DEVICE_SPECIFIC_IEC_REGISTER_COUNT  7   //Number of IECx registers implemented in the microcontroller (varies from device to device, make sure this is set correctly for the intended CPU)
    #define USB_HAL_VBUSTristate()    {TRISFbits.TRISF7 = 1;}

That's it
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf