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.

MPUSBRead() returning all zeros

Status
Not open for further replies.

arhi

Member
I'm trying to make use of 18f2550 USB module without much success. I'm using the firmware for PICDEM_FS_USB as a basis of operation but without much luck.

I do recognise the device, install the driver and whole cha bang, but the problem is that MPUSBRead() is returning zeroes :( .. I'm using the pnp demo code from microchip, that should communicate with picdem_fs_usb firmware. It sends the code to read pot, and reads the result from the usb device ...

4 things that I need to achieve:

1. plug in the device to usb, OS recognises the device [working]
2. detect the device from native application [working]
3. send data to device [not working]
4. receive data from device [not working]

3. send data is done using MPUSBWrite(); The number of bytes sent from PC is shown on the uC, but, I send 0x37 and the uC sees 0x44 ?!?!

4. receive data from device is done via MPUSBRead();, the number of bytes sent from the uC is "correct" but content of those bytes is always 0 ?!?!?

posting the code would not help much as it is basically microchip code (on pc and on uC) only the parts that use portD (for led's) are removed as 18F2550 does not have port D

with regards to schematic, 20MHz crystal, pic running on 48MHz, MCLR pulled up with 4k7, 100uF on vss/vdd on pic, 47uF between VUSB and GND, 100uF vss/vdd on programming connector (6pin for pickit2), gnd from usb to gnd of the ckt, d- from usb to d- on pic, d+ to d+, and that's about it... 3 electrolytes, one resistor, uC, usb connector and crystal, ah yes, 2x22pF to GND from crystal.

I tried power from pickit2 and from USB, I can attach independent power source if needed.

Any ideas why uC identifies properly as usb device (vpid/vsid/manufacturer...) and then simple read/write goes wrong ?!?! Any idea what to check (I will attach osc. to the D+ / D- lines in few minutes but not sure if that will give me any usefull data)?

Thanks in advance
 
3v0m thanks for the hint ... I spent ~30h making this work and I gave up. I implemented the CDC (serial) communication and it works (same hw so there was definitely some sw problem why "custom driver" did not work.... ) .. I always used CDC before and this was attempt to make the "custom drver" to work, but after this much time and fairly useless doc's I gave up :( (cdc is more then satisfactory for what I need on this project)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top