Skip to content

issue with UOWN bit #23

@jerrymessina

Description

@jerrymessina

I've been using the 18F2x/4xK50 for some USB projects lately, and recently ran across an issue you might want to be aware of.

Once in a while the device would just stop responding to host requests (I was using CDC at the time, and a different USB stack). Poking around I found that the K50 was sending a STALL response to the host DATA_IN packet, and everything just stopped.

Reading through the K50 datasheet there's a note that caught my eye:

The firmware should not set the UOWN bit in the same instruction cycles as any other
modifications to the BDnSTAT soft register. The UOWN bit should only be set
in a separate instruction cycle, only after all other bits in BDnSTAT (and
address/count registers) have been fully updated.

I haven't seen that note in previous datasheets, but it's also in other recent ones like the 16F1xxxx w/USB.

The old MLA stack doesn't follow the note's recommendations. Looking at newer versions of the mchip code I see they've changed it to meet the above (quite a while ago, actually).

I made that change to my stack code and bingo, things started working like normal. Don't know if it effects other chips or not, but the newer mchip code changed it for all chips as I recall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions