Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

USB - Brad Minch software - Questions

Status
Not open for further replies.

atferrari

Well-Known Member
Most Helpful Member
18F4550 - Registers dedicated to USB

1) In the datasheet, generic names assigned to buffer descriptors for endpoints are:

BDnSTAT : BD Status register
BDnCNT : BD Byte Count register
BDnADRL : BD Address Low register
BDnADRH : BD Address High register

But Brad Minch seems to define separate blocks for IN and OUT (some shown only).

#define BD0OST 0x0400
#define BD0OBC 0x0401
#define BD0OAL 0x0402
#define BD0OAH 0x0403

#define BD0IST 0x0404
#define BD0IBC 0x0405
#define BD0IAL 0x0406
#define BD0IAH 0x0407

#define BD1OST 0x0408
#define BD1OBC 0x0409
#define BD1OAL 0x040A
#define BD1OAH 0x040B

#define BD1IST 0x040C
#define BD1IBC 0x040D
#define BD1IAL 0x040E
#define BD1IAH 0x040F
................................

Why?

2) In the .INC file defining USB values, we find this notation:

#define TOKEN_OUT (0x01<<2)
#define TOKEN_ACK (0x02<<2)
#define TOKEN_IN (0x09<<2)
#define TOKEN_SETUP (0x0D<<2)

a) What is the actual meaning of each case?

b) Isn't it simpler to define a plain binary or hex value?
 
**broken link removed**
 
The LAB1 code is for a 16C745, not sure what compiler they used. It's going to be different with the C18 compiler. The LAB2 demo might be a closer match.
Take a look at the code on this page for the 18F2550 (will work on the 18F4550)
**broken link removed**
 
Hi Bill,

I failed to say I work in Assembly only. I know nothing of C.

Had I know C, the project you pass the link to could have been useful. Thanks for that anyway.

Could you still help?
 
Last edited:
I'm the same boat, I'm learning C18 and it's a love / hate relationship. It's actually fairly easy to read if you know PIC assembler. The syntax is right out of 1950's era punch card computing.
I'll keep my eye open for USB assembly stuff, have you read through Jan Axelsons USB book?
 
Not yet. Meanwhile, I wil try the Labs from Brad Minch.

If you take a look to explain the notation (please check the .ASM files, not the C ones) I will appreciate your reply.

Gracias.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top