Forum: Mikrocontroller und Digitale Elektronik BUG PIC18F2550


von Ron N. (blitzgeist)


Lesenswert?

Hallo zusammen,

kann mir jemand erklären oder an Hand von Code zeigen wie ich den 
workaround in die Microchip fw einbinde, der im Datenblatt unter 
17.5.1.1 gezeigt ist, sodass der PIC nicht immer in den suspend mode 
geht?

lg
blitzgeist

von Kloberscht (Gast)


Lesenswert?

17.5.1.1?

Ich hab mir jetzt exakt das aktuellste Datenblatt gezogen, ich finde 
dieses Kapitel nicht. Wovon sprichst du?

von Kloberscht (Gast)


Lesenswert?

BTW: hab gerade gesehen, dass das Datenblatt noch immer den Status 
"Preliminary" hat. kopfschüttel

von Ron N. (blitzgeist)


Lesenswert?

Hi Kloberscht,

daspdf hat den Namen 39632D. Google mal, erster Eintrag. Ja und das 
Kapitel 17.5.1.1 steht aus Seite 179. Das Kapitel heißt: Bus Activity 
Detect Interrupt Bit(ACTVIF). Von anderen Quellen habe ich das hier:


You should first understand why you have been suspended, and what your 
duties as a device are in this state.
You will always be suspended 3ms after plugging in the device because 
the host won't send SOFs before it has reset the device, so there is no 
activity on the bus, so you must go into suspend mode until the resume 
signal is received.
In the suspend state you must ensure that you do not draw more than the 
permitted suspend current, which probably means that you must go into 
'sleep' mode on the PIC.
The code as originally written by Microchip tended to work correctly 
except that it was left up to the coder/designer to ensure that the 
current drawn was in specification for the suspend state (by entering 
sleep mode).
Unfortunately the PIC18F2550 has a bug in the suspend/resume logic, 
which was not known to Microchip at the time that they wrote the 
framework code. This resulted in a failure to resume correctly if the 
timing was slightly changed in the code. This bug they have chosen to 
document in later versions of the data sheet as normal operation, so see 
17.5.1.1 Bus Activity Detect Interrupt Bit (ACTVIF) in the 'c release of 
the data sheet. I solved this bug by a different procedure myself, but I 
am informed that the Microchip workaround is also effective.

Das workaround sieht so aus(aus dem Datenblatt):
1
UCONbits.SUSPND = 0;
2
while (UIRbits.ACTVIF) { UIRbits.ACTVIF = 0; }

Doch wo füge ich das in der firmware genau ein?

Dachte hier:
1
void USBWakeFromSuspend(void)
2
{
3
    /* 
4
     * If using clock switching, this is the place to restore the
5
     * original clock frequency.
6
     */
7
    UCONbits.SUSPND = 0;
8
    UIEbits.ACTVIE = 0;
9
    UIRbits.ACTVIF = 0;
10
}//end USBWakeFromSuspend

Doch ohne Erfolg! Mir gehen echt bald die Ideen aus, wie ich diesen 
Fehler beheben könnte. Was mich nur wundert ist das es bei 
sprut(http://www.sprut.de/electronic/pic/8bit/18f/programm/usb2550/usb2550.htm) 
alles so einwandfrei funzt.

Wer kann mir da weiterhelfen?

lg,
blitzgeist

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.