FX2 Standalone betrieb

OP #1947948
Lesenswert?

Hallo,
Ich habe das High Speed Interface Module von Braintechnology.de.

Mein Module bootet aus dem EEPROM und meldet sich problemlos an.

Jetzt möchte ich es autonom betreiben. Hierzu habe ich eine externe 
Spannungsversorgung angeschlossen und die Spannung vom USB Port 
unterbrochen.

Wenn ich nun die Spannung anschalte (USB Host verbindung besteht) meldet 
sich das gerät wie gehabt an.

Wenn ich jetzt aber das Module vom USB Port trenne stoppt der µC die 
Arbeit.

Kann es sein, dass das USB device in eine Art standby geht? Wenn ja wie 
kann ich das unterdrücken?

Ein weiteres Problem ist, dass wenn ich das Gerät wieder anschließe, das 
es nicht mehr richtig erkannt wird. Es erscheint "Unbekanntes Gerät" im 
Geräe-Manager. Muss ich meiner FW, auch die ganze enumeration 
beibringen? Beim erstenmal funktioniert es doch auch?

Vielen dank für die Ideen schonmal.

Grüße Thomas
OP #1948008
Lesenswert?

1
   // clear the Sleep flag.
2
   Sleep = FALSE;
3

4
   // Task Dispatcher
5
   while(TRUE)               // Main Loop
6
   {
7
      if(GotSUD)            // Wait for SUDAV
8
      {
9
         SetupCommand();          // Implement setup command
10
           GotSUD = FALSE;            // Clear SUDAV flag
11
      }
12

13
      // Poll User Device
14
      // NOTE: Idle mode stops the processor clock.  There are only two
15
      // ways out of idle mode, the WAKEUP pin, and detection of the USB
16
      // resume state on the USB bus.  The timers will stop and the
17
      // processor will not wake up on any other interrupts.
18
      if (Sleep)
19
          {
20
          if(TD_Suspend())
21
              { 
22
              Sleep = FALSE;            // Clear the "go to sleep" flag.  Do it here to prevent any race condition between wakeup and the next sleep.
23
              do
24
                  {
25
                    EZUSB_Susp();         // Place processor in idle mode.
26
                  }
27
                while(!Rwuen && EZUSB_EXTWAKEUP());
28
                // Must continue to go back into suspend if the host has disabled remote wakeup
29
                // *and* the wakeup was caused by the external wakeup pin.
30
                
31
             // 8051 activity will resume here due to USB bus or Wakeup# pin activity.
32
             EZUSB_Resume();   // If source is the Wakeup# pin, signal the host to Resume.      
33
             TD_Resume();
34
              }   
35
          }
36
      TD_Poll();
37
   }

Das steckt doch alles da drin oder nicht?
1
         SetupCommand();
für die richtige anmeldung am host und
1
            Sleep = FALSE;
Damit das Modul, wenn der USB stecker gezogen wird nicht in den Sleep 
Modus geht oder nicht?
#1948058
Lesenswert?

Nee, das ist was anderes. Du musst die Self-Powered Application Note 
beachten. Da musst du VBus pollen und entsprechend das DISCON Bit setzen 
und rücksetzen. Wir machen das auch so und der FX2 arbeitet auch bei 
abgezogenem USB Kabel. Pollt zwar bei uns nur VBUs und ob das FPGA 
fertig gebootet ist, aber er arbeitet. Wenn du das mit dem Discon Bit 
richtig machst, meldet der sich auch korrekt an beim Wieder-Anstecken.
OP #1948102
Lesenswert?

ok, also so funktioniert es:

Das Device ist natürlcih jetzt self powerd.
1
   Selfpwr = TRUE;            // Enable self powered

Damit beim abstöpseln des USB ports das device nicht in den Sleep modus 
geht muss dies unterbunden werden
1
      if (FALSE)
2
          {
3
          if(TD_Suspend())
4
              { 
5
              Sleep = FALSE;            // Clear the "go to sleep" flag.  Do it here to prevent any race condition between wakeup and the next sleep.
6
              do
7
                  {
8
                    EZUSB_Susp();         // Place processor in idle mode.
9
                  }
10
                while(!Rwuen && EZUSB_EXTWAKEUP());
11
                // Must continue to go back into suspend if the host has disabled remote wakeup
12
                // *and* the wakeup was caused by the external wakeup pin.
13
                
14
             // 8051 activity will resume here due to USB bus or Wakeup# pin activity.
15
             EZUSB_Resume();   // If source is the Wakeup# pin, signal the host to Resume.      
16
             TD_Resume();
17
              }   
18
          }

Oder einfach rauslöschen und dann funktioniert alles wunderbar ;)

Grüße Tomtom
OP #1948230
Lesenswert?

mh... mist ich hab erst jetzt deinen Eintrag gelesen.

mh... Dann würde das Device aber ja trotzdem in den sleep modus gehen. 
Also den zweiten Teil den ich gepostet habe muss man aufjedenfall 
rauswerfen.
1
   Selfpwr = TRUE;            // Enable self powered
hat wirklich keinen Einfluss darauf.

So wie ich es beschrieben habe funktioniert es aufjedenfall auch. 
Natürlich schafft die von dir erklärte Lösung mehr Sicherheit.

Ich muss mal schauen, welche der beiden Lösungen ich jetzt verwenden 
werde, da es bei mir hier eigentlich recht zuverlässig läuft.

Grüße tom

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren