Closed noranger closed 1 year ago
TurnOnUSB only sets GPIO33 to HIGH. If you operate on IO33 externally, it may be affected
Gpio 33 is reserved for UART_TX, but i need power. Gpio33 is not used by turnOnUSB().
I made a mistake. The USB enable uses GPIO4, while the relay of LilyPi uses GPIO32 Do you use GPIO4 anywhere else?
No
Please use the simplest test code to just set GPIO4 to HIGH and see if USB will maintain output
void setup()
{
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
}
void loop(){
}
Only Power after booting for 20ms. My Code for Setup.
//boardmanager esp32 Wrovwer Modul (LilyPi)
Serial_CAN can;
unsigned char flagRecv = 0; unsigned long id = 0; unsigned char rxBuf[8]; char str[20];
int temp=0; int temp2=0; int kreis1=0;int kreis2=0;int kreis3=0;int gang=125;int retarder=0;int mbremse=0;int gewicht=0;int partikelf=0; char Motortemp[4]; char Intarder[4]; char Gear[4]; char Exhaustbrake[4];
TTGOClass *ttgo;
void setup() { Serial.begin(115200);SPI.begin();
//pinMode(EXTERN_USB_EN, OUTPUT); pinMode(4, OUTPUT); digitalWrite(4, HIGH);Serial.println("USB On");
//Get watch instance
ttgo = TTGOClass::getWatch();
ttgo->begin();
//ttgo->openBL();// Turn on the backlight
ttgo->tft->setRotation(1); ttgo->tft->setTextFont(4);
ttgo->tft->fillScreen(TFT_BLACK);ttgo->tft->setTextColor(TFT_WHITE,TFT_BLACK);
can.begin(can_tx, can_rx, 115200); // tx, rx
if(can.canRate(CAN_RATE_250))
{Serial.println("set can rate ok");}
else
{Serial.println("set can rate fail");}
.......
There is no problem with the code. Are you connected to an external load? Please remove the USB load and try to see if this happens. I suspect that the current of the external load is too large, which causes the USB current-limiting start
Yes. Now the Usb power is on all ports. I testet it with a led. 3v and 5v switching works too. The Serialcanbusboard is now making problems. Thanks for your fast help.
How can the USB ports switched on constantly. digitalWrite(EXTERN_USB_EN, HIGH); or ttgo->turnOffUSB(); only works for a second after booting.