View Full Version : 'undocumented bit' 0x40 in USB0_TRC0 0x40

12-10-2012, 05:33 AM
referencing usb_dev.c:usb_init, there is a set to a reserved bit in the
USB0_USBTRC0 register at 0x40.

there clearly may be other problems with my code, but if I set this bit I
take a fault.

is there any background as to where this bit came from?

thanks for your time

12-10-2012, 05:30 PM
well, the crash was caused by the erroneous use of 32 bit accesses on the trc0 register.

i've tried removing this from a version I have based on the reference code from pjrc, and it still seems
to move packets, so my problem is almost certainly in bdt management.

it would be interesting to know what this guy is supposed to do

12-10-2012, 08:44 PM
I wish I knew too! I suspect it does nothing, but might do something in other Freescale chips which have basically this same USB peripheral?

Freescale's example code sets that bit, but their code is a mess... obviously adapted from Coldfire and even HC08. They also use the bit which resets all endpoint data toggles (at least I understand it) during control transfers, which seems very odd to me. I've never gone to the trouble of setting up a working CodeWarrior installation (I mainly use Linux... and getting it to work seemed like a lot of fiddling, at least with the early versions when I developed my USB code).

Freescale's example also only manages a fixed 2 packet buffer scheme for each endpoint, which is easier but doesn't allow enough buffering for simple Arduino-based code using Serial.print to achieve the best USB speeds when used together with libraries like LiquidCrystal or OneWire. So for Teensy 3.0, I mostly ignored Freescale's example code and mainly relied on the datasheet and a LOT of testing.

If you do observe that bit doing anything at all, please let me know!