This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
fougere


Advanced Newbie


Joined: 07 Aug 2009
Posts: 56

Posted: 30 Aug 2009 05:38:39 pm    Post subject:

Hello,

I've written some code capable of functioning as a 3rd party OS for my ti-84+SE, and it seems to work fine until I remove my USB cable, at which point it freezes. The On-key will still generate an interrupt, but everything else (ie, the rest of the keyboard) will not work. The On-key interrupt routine is supposed to execute a soft powerdown until the next interrupt; however, after powering down, it locks up and will not restart even if i remove a battery. My only option is to reinstall the os again using the 'delete' key. (Prior to the USB cable removal, the soft powerdown routine works fine)

Has this happened to anyone else? I can provide my code if necessary.

Thanks

EDIT: battery removal while leaving the cable plugged-in produces the same effect
is there some sort of USB interrupt that I should be handling?


Last edited by Guest on 30 Aug 2009 05:51:31 pm; edited 1 time in total
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 30 Aug 2009 05:53:36 pm    Post subject:

Yes, I've had the same issue, and yes, there are USB interrupts you should be handling.

It's extremely complicated and hard to explain, so it's best to look at OS disassembles, usb8x, periph8x, and OS2 (some of that is in http://brandonw.net/svn/calcstuff and [url="http://brandonw.net/svn/calcstuff/OS2)"]http://brandonw.net/svn/calcstuff/OS2)[/url]
Back to top
fougere


Advanced Newbie


Joined: 07 Aug 2009
Posts: 56

Posted: 31 Aug 2009 05:56:53 pm    Post subject:

Thank you, although it may take me a while to sift through it all and figure out what I need and don't need..... Is there any way to easily prevent the USB from interrupting in the first place??
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 31 Aug 2009 06:36:40 pm    Post subject:

USB interrupts can be disabled (theoretically) by outputting zero to port 5Bh, but I haven't seen this help with hanging (but maybe I just screwed it up when I tried).
Back to top
fougere


Advanced Newbie


Joined: 07 Aug 2009
Posts: 56

Posted: 31 Aug 2009 07:29:50 pm    Post subject:

outting 0 to port $5B also failed for me.
what about quickly acknowledging all USB interrupts? (just like you would out 0 to port 3 for normal interrupts)
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 31 Aug 2009 07:37:51 pm    Post subject:

Attempts to do that (at least for me) have failed.

Implementing USB on the 84+/SE (and 89Ti) is just plain awful and not at all straightforward. Sad It's so poorly-documented and cryptically-used that we can never truly understand it.

That's not to say that we can't do everything the TI-OS does (and more (usb8x, periph8x)), it's just a pain to get there.


Last edited by Guest on 31 Aug 2009 07:39:09 pm; edited 1 time in total
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 31 Aug 2009 07:53:00 pm    Post subject:

What is the major problem of USB developement?
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 31 Aug 2009 07:59:15 pm    Post subject:

I just said it's poorly-documented and so cryptically-used in the OS that it's impossible to determine what does what. It's all out of context.

Glance at the USB documentation on WikiTI and you'll see how truly awful it is, or the usb8x source (or the periph8x source).

If you guys can understand it better, by all means, please do so and document it thoroughly.

(It's so crazy that TI didn't even properly emulate it in the Nspire's 84+SE emulator; they replace all that junk code with invalid instructions which allow the emulator to take control and perform the requested USB operation in a much more sane way.)
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 31 Aug 2009 08:06:24 pm    Post subject:

Working with the USB hardware is complicated and ugly because USB is complicated and ugly. If the hardware interface were higher-level (and thus easier to use) it wouldn't be possible to do nifty things like msd8x and periph8x. :)

Is there no way of just disabling the USB controller completely?
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 31 Aug 2009 09:20:17 pm    Post subject:

That logic makes sense, but I can't believe that the interface couldn't be cleaned up a little more than it was.

I know of no way to completely disable the controller.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 31 Aug 2009 10:11:59 pm    Post subject:

I'm sure you're right; the hardware does seem pretty nasty from what little I've done with it.
Back to top
fougere


Advanced Newbie


Joined: 07 Aug 2009
Posts: 56

Posted: 02 Sep 2009 05:14:03 pm    Post subject:

EUREKA!! The solution, although very 'brute-force-ish', is actually quite simple! Logically, you would think that to disable something/shut it off, you should send zero to whatever port controls it. Well, I decided to send zero to every single USB-related port during my interrupt routine in response to any interrupts not identifiable by port 4:
Code:
   xor a
   ld c,$4C
   ld b,$AF-$4C+1
USBPorts:
   out (c),a
   inc c
   djnz USBPorts
Amazingly, it works!!! Smile No hanging when I remove my cable!
Now, I guess I'll have to run a lot more tests to figure out which port/combination of ports is responsible for this.
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 02 Sep 2009 05:42:52 pm    Post subject:

Amazing!!!!
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 02 Sep 2009 07:34:38 pm    Post subject:

That's a scary solution, but I'm glad it worked for you. Hopefully you can narrow the range and figure out which port(s) it was. I'd be interested in knowing.
Back to top
fougere


Advanced Newbie


Joined: 07 Aug 2009
Posts: 56

Posted: 03 Sep 2009 03:56:29 pm    Post subject:

It's port $57!!!
Sending 0 to port $57 will acknowledge the USB interrupts and prevent hanging!
Smile !

Edit: Should this be added to the WikiTI documentation here?


Last edited by Guest on 03 Sep 2009 03:58:30 pm; edited 1 time in total
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 04 Sep 2009 10:41:54 am    Post subject:

Discovered something new again! Congratulations!
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 04 Sep 2009 02:28:40 pm    Post subject:

Go ahead and document it on the wiki if you want, though there's still a lot we don't know about that port. I've seen it get zero in USB error code, but I've also seen it get 10h, 20h, 22h, 80h, 90h, 93h, and others in initialization. I've also seen bit 4 get zeroed out. I've also seen dummy reads from it, and "flushing" it out (back up what's there, send zero to it, restore what was there).

It's just another example of how we have no idea how the USB interface works. Some ports we can understand through context, but this isn't one of them.
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 04 Sep 2009 04:42:21 pm    Post subject:

brandonw wrote:
Go ahead and document it on the wiki if you want, though there's still a lot we don't know about that port. I've seen it get zero in USB error code, but I've also seen it get 10h, 20h, 22h, 80h, 90h, 93h, and others in initialization. I've also seen bit 4 get zeroed out. I've also seen dummy reads from it, and "flushing" it out (back up what's there, send zero to it, restore what was there).

It's just another example of how we have no idea how the USB interface works. Some ports we can understand through context, but this isn't one of them.

So if you have someone that understands usb better, would that work?

I could help. I am not an expert, but have some experience with communicating with TI as a peripheral.
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 04 Sep 2009 05:13:48 pm    Post subject:

My point was that it's so confusing that we're probably never going to understand what we don't already know from things like usb8x (which is more than enough to do calc<->calc, PC<->calc, and USB host/peripheral communication involving other devices/classes).

If there are things known about ports that aren't on WikiTI, go for it.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement