|
![]() USB
![]() USB HID on F320 - dead transfer - how to debud and profylaxe ???
|
| next newest topic | next oldest topic |
| Author | Topic: USB HID on F320 - dead transfer - how to debud and profylaxe ??? |
|
ferika Member |
I does a little project for transfer A/D data to PC and transfer RS232 from/to PC. On the same USB connection. I used the HID USB example project as base for this. And the mcHID.dll as driver, beause it is the only one (if you know other, or better, tell me pls.) that can serve event driven USB messages inside of VB.Net program. (Like before OnCOM event inside VB6). This is the better way to get USB communication as polling the read function. BUT! The communication will be dead after indetermined time interval. It may be dead after 1 minute, or 1 hour, or will be running longer than 1 day. I think, that the USB firmware routines have a bug, or the low-lewel implementation is bad. Now i wish intensively test this, but i do not know how! Have you (event. solved) such problems? May be, the input buffer will be full, but the function returns bad value? Can i analyse this and give the communication a reset? Or the send routine have inaccesibble buffer? Or the message will be not sent properly and the buffer stay busy for ever? Or, or, or, ... Apropos: Have read here on forum about blocked USB communication, because the power supply was noisy, or the USB signal was disturbed or similar. How to solve such a dead USB communication? Is true, that a communication interface will be busy for ever?! It must exist a solution to determine such error status and kill them. May be this is the same problem as i have, but USB is an interface, that should solve error states automaticaly and not hanging up forever? Help please, because all works properly, only the USB dont! (On which points may be good give breakpints to determine the working state of the communication?) Thank you, IP: Logged |
|
Tsuneo Member |
A hardware bus analyzer gives good clue after the hang occurs. - If polling IN transactions are observed, HID class driver on PC works fine. Otherwise, the class driver is dead. - If device returns right input report to the IN transaction, device is fine. PC application or DLL is dead. Otherwise, the device is dead. Software sniffer can't see good clue after the hang occurs. If it would record traffic before the trouble occurs, it may catch any clue. But I'm not sure sniffers can hold trace for an hour or more. Random error is often caused by noise. Tsuneo IP: Logged |
|
ferika Member |
Thanks, but we have USBTrace soft analyser only. The HID_Blinky example is a pretty application to look, how to make multiple data transfers through one USB connection. IT was the base for my test-project. As a second way to solve this problem were following "soviet way" - if we cannot find the source of those errors (apropos - it is the original C8051F320DK eval. board!), then we should healt the errors - how to modify the Blinky code, that if until 5 seconds no succesfull transmission happens in the needed direction, either a watchdog reset, or - and better - a reinitialisation of the USB interface on the 8051F320 will be done! This will be made to run communication over USB again and the buffers of serial interface will be unattached and can be send again! Better one silent reset in 4-5 hours, than pay 3-4 watchmans, to observe the equipment 24 hours on a day. How can i do softvare reinitialisation (may be with right initialized watchdog with prescaller) of the USB interface? Best as example for the existing example (HID Blinky ??? Apropos - this is my second unsolved problem - do the drivers please able (with examples) to make possibble event driven programms in the VB.Net - no polling pls.! No C++ please - we are experts in metheorology, hardware technik and so far., but not professional programmers. We do simple application oriented programms only. From scheme, layout, to slodering, programming - all especialy made for our test equipment. C, VB6.0, VB.Net, 8051 assembler, ... but so sorry, not C++. Mea culpa, mea culpa, ... i know, but its true! Feri IP: Logged |
|
ferika Member |
PS: Can the USB not alone detect bad state and reactivate herself? Is the protocoll of USB not made for detect errors and reinitialise the interface? I do frequently projects with CAN Bus. Disturbed message will be ignored and the next message will be ok. Why do the USB hang up? Yes, we have other USB A/DC's, I/O's and so far, that are placed on tower of the weather radar. They have sporadic "holes" in the communication - is natural under circumstances of high intensity radar waves, but never was this equipment dead for time longer, than 1-2 USB message length. I think, the USB should flush the disturbed packets and receive/send again. Thank you, Feri IP: Logged |
|
ferika Member |
Can be, that the USB interface on Silabs MCU's are not implemented properly? How is the low-lewel handling of the USB interface. Are the low-lewel routines programmable by user? Or are those fix implemented in the hardwre. Know users CPU's from other companies, that causes similar problems, or not? Thx, IP: Logged |
|
ferika Member |
OK, have little bit analysed problem: IF DEAD USB HAPPENS, THEN THE IN DIRECTION IS DEAD, OUT IS STILL ACTIVE! By dead USB connection my host programm in VB.Net is still living, if i does reset them or not, the situation will be the same. USB packets from C8051F320 CPU into PC (IN packets) are not generated, because the USB routines in the CPU signalize busy interface. The OUT packet way is working well under those circumstances, packets sent from PC to CPU will arrive OK, and all other routines in the CPU are working well too. RS232 interface, A/D converter, ... , and all related interrupts are ok. Only the packet send function "void SendPacket (unsigned char ReportID)" will be returned without any action, because both conditions are false: This signalise, that the send buffers going newer to IDLE status, allthrough no data are more sent to PC! PC site is not guilty on this mistake, beause the reset of PC sided software establish the connection not. Only reset of the CPU alone turn the communication again on! Then my question: Thank you, IP: Logged |
|
ferika Member |
And last word to this problem - as last test equipment i had one PC with relative slow CPU and without gamers videocard (moderate power consumption, wirthout drastical spikes). The tested board was original C8051F320DK powered with original Silabs power supply. It was connected via RS232 cable to the same PC. The test programm in VB.Net has sent approx. 50x/sec. 8 bytes A/D data to the PC and bidirectional send/reacive approx. 50 bytes/sec. via RS232. The 230V power goes through UPS (Back-UPS CS 500 from APC) and additional filtered. Latests after 4 hours was the USB-in communitation dead!!! What should i filter against noise? Original USB cables? Original USB connectors soldered on board? Or the USB connector on PC? On this connector i have alvays connected USB equipment without problems 24 hrs/day! What now? Please help! Thx, Feri IP: Logged |
|
stu New Member |
If it was a problem of noise,i'd like to advise that: 1. try to make a connection from USB Shell to USB GND on PCB; 2.on the other way,you could also check your PC,normally, USB socket's Shell was connected to PC's system GND; 3.check USB Cable,twist pair was recommended,shield must be present,and was connected to USB socket's Shell on both ends.
[This message has been edited by stu (edited July 01, 2010).] IP: Logged |
|
ferika Member |
Yes, but how can be present noise problem on a near ideal hardware equipment on a original Silabs evaluation board. I think, other equipment in the real world will be not so ideal like mine - what to do then? And - if the noise problem is present by many users - why do search the problem in the noise, if may be, the hardware or firmware on the Silabs chip is bad?! And - if this problem is present, it must be the way, how to detect this "hanging state" of the MCU to kill them in the software! END MOST IMPORTANT - if this problem is present by Silabs MCU's, the any shielding and "denoising" helps to sink the sensitivity for those effects, but not healt them! In case of stronger noise, or electricity impulse such interface will be hang again! The USB interface was made for work with noise signals too - no hanging is allowed. It must detect and repeat disturbed packets itself - may be 1-2-3 packets will be lost, but the interface must live. So sorry, but i think, we will healt problems that are on the MCU side. Thank you, IP: Logged |
|
stu New Member |
I'd ever build similar project,which sent empty HID packet to make sure that USB connection is live,otherwise,reset MCU in firmware; IP: Logged |
|
ferika Member |
Thx! Yes, i think too, that it may be a way for many projects (make a digital loopback to find out, if the soft and/or connection is working or not). BUT! It is not good solutions for many other projects, who the software should be running for more days or weeks and the state of the CPU must be always determined! I have programmed many boards who all MUST RUN any weeks without crash! I have controller boards in weather radar, that must run under all circumstances 24 hours/day and no one reset is allowed! Reset cause new start of the whole megawatt transmitter and repeated testing of whole settings and calibration parameters! Not acceptable! It is running with Dallas 8051 compatible CPU's with CAN Bus interface on 100m cable length between control units and receiver/transmitter on radar tower. USB is designed for continuous operation under noisy and disturbed connections too! Packets may be lost, but never can crash and for ever hang the connection! If this happens, something is very, very wrong! Reset, or watchdog is a solution for catastrofical case, for handling extraordinal exceptions, but not as solution for normal working equipment. (And as i told before, mine equipment is very, very optimized in my laboratory, without high power devices, so that no horrible disturbances can occur.) I think, the MCU is not ok. To healt the consequences instead of real causes is not acceptable. If this happens only by me, than i can think i is my problem. But if this happens by other MCU, by other users and under different hard/soft circumstances too, than i can think, that the implementation of the USB interface in the MCU is wrong. The solution recommended by Silabs, with optimized USB noise, can reduce the probability of communication failure, but never eliminate it on acceptable level. It is my position, i will be happy, if i am wrong! (Here may be come the post from Silabs Thank you, IP: Logged |
|
ferika Member |
YESS! 50% solved! It is solved (i hope) for me in the way: "If do not go Mohammed to the hill, then must the hill go to Mohammed!" So, i think, that the problem occur if an IN packet will be send from CPU to PC and the CPU does not set the EP_STATUS[1] byte to right value. The EP_STATUS[1] hang on status EP_TX for ever !!! Why? May be, that the firmware does not generate the interrupt after transfer ?! If the transfer was done ok, then the interrupt generated via the CPU must set status to EP_IDLE, or if the transfer was bad, then the interrupt must set the status to EP_STALL or EP_HALT (i am not USB expert, do not know, what is better in this case). If the interrupt was under concrete circumstances not generated, caused that the status is fixed as EP_TX and all next comming USB-In packets will be rejected! The PC as master cannot reanime the communication - because the PC knows not about the problems on CPU side. The communication way for OUT packets from PC to CPU is still running and the PC have no other information. The test, if the CPU USB-In communication is hanging and the reanimation of it must be done only in the CPU alone. I have tested -after the USB communication was hanging again - simple stop the CPU programm execution, set manual the EP_STAUS[1] to EP_IDLE - and voila! The USB communication is running again. Hureka! The questions are now: 1.) how to simply detect, that the USB-In is dead? 3.) Most important for the 100% solving of this problem - why the CPU does not right handle the USB-In trasfer? I make next week new, modified routines to solve this problem and make a post here. Than you, IP: Logged |
|
ferika Member |
OK, it is true !!! The CPU forget (with actual soft) to release the send buffer of USB if any problem was caused. Silabs named those effects "noisy USB line". Because this happens not by mine F320 type CPU, but i have read by other CPU exist this problem in similar way too, then i make new thread - not to talk about, but to find out the solution for this! Bye, IP: Logged |
|
ferika Member |
The problem was solved and the solution was described in this thread: http://www.cygnal.org/ubb/Forum9/HTML/002088.html Please do not post to this thread, go on the thread above. IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?