signal11 / m-stack

Free USB Stack for PIC 16F, 18F, 24F, and 32MX Microcontrollers

Home Page:http://www.signal11.us/oss/m-stack/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PIC18F45K50

qwertymodo opened this issue · comments

I've been playing around with the PIC18F45K50 for a few days now trying to get it working. Using the official MLA source, I was able to get the config pragmas and USB init sequence working. I tested it by loading the HID Mouse and CDC projects, duplicating the PIC18_Starter_Kit_PIC18F46J50 project config and switching the device to 18F45K50. This was enough to get the computer to start enumerating it, but unfortunately, it fails as an "Unrecognized device". Unfortunately, I'm rather limited in my ability to debug exactly where it's failing, but looking at the datasheets, it should be very compatible with the 46J50. I did at least confirm that my hardware is functional by building the HID Mouse demo from the official MLA examples, and that runs perfectly on my board. It would be really nice to get this chip working, as it is a 5V device with a ton of I/O pins which can run directly off of VBUS and its internal oscillator, needing only a couple of decoupling capacitors, making it a really good device for simple USB-to-I/O bridge applications like the 16F145x chips, but with way more pins.

Here are the config and initialization to get it running on the internal oscillator: qwertymodo@45e8bee

Poking around a little more, the error reported by Windows is

A request for the USB device descriptor failed

And here are the event logs for the device.

Device not started

Device USB\VID_0000&PID_0002\5&212ac8fc&0&1 had a problem starting.

Driver Name: usb.inf
Class Guid: {36FC9E60-C465-11CF-8056-444553540000}
Service: 
Lower Filters: 
Upper Filters: 
Problem: 0x2B
Problem Status: 0x0

Device configured (usb.inf)

Device USB\VID_0000&PID_0002\5&212ac8fc&0&1 was configured.

Driver Name: usb.inf
Class Guid: {36FC9E60-C465-11CF-8056-444553540000}
Driver Date: 06/21/2006
Driver Version: 10.0.16299.15
Driver Provider: Microsoft
Driver Section: BADDEVICE.Dev.NT
Driver Rank: 0xFF0000
Matching Device Id: USB\DEVICE_DESCRIPTOR_FAILURE
Outranked Drivers: usb.inf:USB\DEVICE_DESCRIPTOR_FAILURE:00FF2000
Device Updated: false
Parent Device: USB\ROOT_HUB30\4&1ce4e8bd&0&0

Device not migrated

Device USB\VID_0000&PID_0002\5&212ac8fc&0&1 was not migrated due to partial or ambiguous match.

Last Device Instance Id: USB\VID_2109&PID_0812\5&212ac8fc&0&21
Class Guid: {36FC9E60-C465-11CF-8056-444553540000}
Location Path: 
Migration Rank: 0xF000FFFFFFFFF122
Present: false
Status: 0xC0000719

Device deleted

Device USB\VID_0000&PID_0002\5&212AC8FC&0&1 was deleted.

Class Guid: {36FC9E60-C465-11CF-8056-444553540000}

There are some pending pull requests that add support for the PIC18F45K50 and/or PIC18F25K50:

#5
#24

Thanks for those. The last missing bit was the BUFFER_ADDR, I left that undefined like the 46J50. That's enough to get the device working, but unfortunately now the CDC demo seems to be stalling. The USB device itself runs fine, but when I try to attach to it with RealTerm, it freezes up RealTerm for a really long time before eventually spitting out a single block of letters and then stopping. At no point does the OS report any problems with the device. Not sure what's up with that.

Edit: Just found #23 which may be the issue I'm running into here.

The stalling issue I experienced seems to be isolated to the CDC demo. The HID demos seem to be working without any issue. Also, I'm not sure if "stalling" is really the right term since that term has specific meaning within the USB spec, so just to be clear there, my use of the word "stall" was purely colloquial.