View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Sep 15, 2005 1:40 am |
|
|
Hi,
I'm working about but I don't realize why in first step it work but in second time the routine "int8 usb_tbe(int8 endpoint)" return false and the system doesn't flush out the bufer. The PIC anyway continue to receve on USB.
Quote: |
/************************************************************
/* usb_tbe(endpoint)
/*
/* Input: endpoint - endpoint to check
/* ptr - where to save data to local PIC RAM
/* max - max amount of data to receive from buffer
/*
/* Output: returns TRUE if this endpoint's IN buffer (PIC-PC) is empty and ready
/* returns FALSE if this endpoint's IN buffer is still processing the last
/* transmit or if this endpoint is invalid.
/*
/************************************************************
int8 usb_tbe(int8 endpoint) {
int8 st;
st=EP_BDxST_I(endpoint);
if (!bit_test(st,7))
return(TRUE);
return(FALSE);
}
|
I don't understand the maning of this routine especially "EP_BDxST_I(endpoint)" does change in second time the result.
The main code as show send back the receved char as debug.
Quote: |
#zero_ram
void main(void) {
char c;
usb_init();
//enable_interrupts(int_rda);
#if !(__USB_PIC_PERIF__)
printf("USBN: 0x%X", usbn_get_version());
printf("\r\n\n");
#endif
while (TRUE) {
usb_task();
if (usb_cdc_kbhit()) {
c=usb_cdc_getc();
putc(c);
usb_cdc_putc(c);
}
}
}
|
Somebody help me? |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Sep 15, 2005 7:19 am |
|
|
Hi Everybody,
I solve a problem about USB software. After connected a 47uF un Vusb pin, the board start to work fine. The system now work also with notebook.
Thanks to everybody does support me |
|
|
ofendt Guest
|
USB Problems |
Posted: Tue Nov 01, 2005 3:44 pm |
|
|
I had the same Promlems with USB 18F4550. Seem to work... crash ... work ... crash
I solved the Problems with 1000uF Cap GND to 5Volt and an otherone GND to Vusb.
Now works great! |
|
|
Guest Guest
|
Getting started on USB |
Posted: Thu Aug 31, 2006 11:24 am |
|
|
I have built a board which uses the 18f4550, and have successfully set it up to use the CCS ex_usb_serial2 project. I have it set up to transfer characters from an RS485 bus directly to USB. I am using the driver provided by CCS (cdc_NTXP.inf). It works great for a few seconds or a few minutes, but then it stops sending data over the COM port. I halted the device while in debug mode and found that it was choking on the usb_cdc_putc function. I am guessing that the USB transmit buffer was full, and the PC was not properly processing and emptying that buffer.
Can someone give me some advice on how to troubleshoot this problem?
Some additional details:
I downloaded some free software called HHD USB Monitor, and I saw that I was only sending 5 to 12 data bytes at a time. This seems to be a poor implementation of USB. I could improve this by making a buffer in which I wait until it gets full, then place this in the uC's USB transmit buffer. I don't want to go to this effort until I understand what is happening with the "locked up port" though.
Also, when I unplug my board (it is USB powered) and plug it back in after it has locked up, Windows states that it doesn't recognize the device and it has malfunctioned. Also, the COM port that it was using when locked up is not released when I unplug the device.
I don't know what tools I need to debug this, but it seems like there are some definite errors on the PC side (driver issues?). |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Thu Aug 31, 2006 1:32 pm |
|
|
To see the usb flow of packets look on the web for snoopypro. It is free and it will sniff the packets for you. Now remember if you have a Microsoft OS things will be quirky. The softeees will interrupt perfectly good transfers of descriptors but the CCS software will work around them.
Once the pipes are set up the quirks seem to end so if you want quirks after that you'll need to make them yourself. Now as to the rare freezing of a USB port ....it seems to be a free feature that comes with the OS. That's why many will never want to buy a PC without a reset button. |
|
|
Guest Guest
|
|
Posted: Thu Aug 31, 2006 1:51 pm |
|
|
Thanks for the response. I hope I can eventually find out what caused this.
After posting my initial question, I saw the previous post talking about noise on the V_USB pin causing some problems for other people. I ended up disabling the internal voltage regulator and instead hooking it up to the regulated supply on my board. This looks like it might possibly have fixed it; the test I am now running has been going for 5 minutes or so with no lock-ups - this is longer than it ever has gone before, with lots of data being transferred. If this doesn't fix it, I will post again if anyone is interested. Thanks for your help! Great forum.
Mike |
|
|
Guest
|
|
Posted: Thu Aug 31, 2006 4:17 pm |
|
|
So I found out that my problem was not only the voltage regulator, but also something going on with the PC driver as well (I think). The board is set up to spit out to USB any characters that the RS485 side sees. Now that the voltage on the Vusb pin is fixed, the terminal program I am using (TTermPro) shows that USB communications are working nicely.
I noticed a new problem, though, and it might be known behaviour. If I drag the terminal program around on the screen, it momentarily locks the program. This is pretty standard behaviour for most programs. However, it is not servicing the data coming over the USB port while I am dragging it around. If I drag it around long enough, then I get a failure. This failure is defined as
1) no more characters coming over the terminal
2) firmware locking on the usb_cdc_putc routine (indicating full transmit buffer I think)
Is this a driver issue that I can resolve by re-defining the driver? Is this something that I should attack in firmware? I am not sure what tools to use to identify the root cause. |
|
|
Kiwime
Joined: 28 Sep 2006 Posts: 2
|
|
Posted: Thu Sep 28, 2006 5:57 pm |
|
|
Hey guys. I'm having the same problem - streaming data from the RS232 port to the USB port and viewing it on hyperterminal - after a few pages of data it hangs. The PIC still receives but the PC doesn't. I've tried putting 1000uF on both Vusb and Vdd. I've tried using an external regulator instead of the internal... Nothing works - it still hangs after a few pages and like you guys I think the PC buffer is getting full and not flushing. Driver problem maybe? How can we flush that buffer if it doesn't automatically happen? |
|
|
ymoona
Joined: 20 Mar 2005 Posts: 32 Location: Heiloo, the Netherlands
|
|
Posted: Fri Jan 12, 2007 2:06 pm |
|
|
Kiwime wrote: | Hey guys. I'm having the same problem - streaming data from the RS232 port to the USB port and viewing it on hyperterminal - after a few pages of data it hangs. The PIC still receives but the PC doesn't. I've tried putting 1000uF on both Vusb and Vdd. I've tried using an external regulator instead of the internal... Nothing works - it still hangs after a few pages and like you guys I think the PC buffer is getting full and not flushing. Driver problem maybe? How can we flush that buffer if it doesn't automatically happen? |
Have you solved the problem already? Im facing the problem right now, when I try to use lcdsmartie as data source. I tried big elcos and small capacitors, but they don't seem to help _________________ checkout my site: www.ymoona.com/wiki |
|
|
wrsalasr
Joined: 09 Oct 2007 Posts: 4
|
|
Posted: Tue Oct 09, 2007 11:35 pm |
|
|
Hi,
I am implementing a USB-RS232 converter, for this I am using ex_usb_serial example, when I send characters using the hyperteminal from COM1 to COM3 (virtual Com) it works fine but when I send back an answer from Com3 to Com1 it doens work.
Somebody help me on to find a problem?
Thanks, |
|
|
legion
Joined: 10 Oct 2007 Posts: 23
|
|
Posted: Wed Oct 10, 2007 12:34 pm |
|
|
wrsalasr wrote: | Hi,
I am implementing a USB-RS232 converter, for this I am using ex_usb_serial example, when I send characters using the hyperteminal from COM1 to COM3 (virtual Com) it works fine but when I send back an answer from Com3 to Com1 it doens work.
Somebody help me on to find a problem?
Thanks, |
Funny that, I'm getting the same one-way result. Hyperterminal is a bit of a dog at times. It tends to freeze if chars are coming in when you connect. I'm about to write a simple VB app to act as a terminal program. All the free ones I've tried so far have too much to go wrong with them.
One thing I've noticed in this thread is the use of very big capacitors on the vusb pin. The spec gives a minimum value of 220nf with no stated maximum - but I think 1000uF is excessive. It'll probably have relatively high ESR and inductance. A 1uF tantalum should be more than enough. |
|
|
|