Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP2040 Core1 stops when connected via usb #378

Open
MNS26 opened this issue Jan 4, 2022 · 3 comments
Open

RP2040 Core1 stops when connected via usb #378

MNS26 opened this issue Jan 4, 2022 · 3 comments

Comments

@MNS26
Copy link

@MNS26 MNS26 commented Jan 4, 2022

after trying to fiddle with the pi pico trying to get core1 to "fade" the builtin led (pin 25 ) it would stop right after upload.
thinking it was a voltage issue (unlikely but who knows) i tried running it without usb and giving it 5v on Vusb directly, then it did work.

(i already wrote something similar in a different issue but that was related to something else)
#217 (comment)

the code i used:

#include <mbed.h>
#include <Arduino.h>
#include "pico/multicore.h"
#include  "hardware/structs/sio.h" 
#define CORE1_LED 25u
int brightness=0;
int fadevalue = 10;
void core1_loop()
{
  while(1)
  {
  brightness=brightness+fadevalue;
  if(brightness <=0 || brightness >= 2048) {
    fadevalue = -fadevalue;
  }
    digitalWrite(CORE1_LED,HIGH);
    sleep_us(brightness);
    digitalWrite(CORE1_LED,LOW);
    sleep_us(1000);
  }
}

void setup()
{
  pinMode(CORE1_LED,OUTPUT);
  //multicore_reset_core1();
  multicore_launch_core1(core1_loop);
}

void loop()
{
}
@dlivingstone
Copy link

@dlivingstone dlivingstone commented Jan 5, 2022

It might be an issue with the empty loop() - try adding a short delay or sleep.

@MNS26
Copy link
Author

@MNS26 MNS26 commented Jan 5, 2022

@dlivingstone then it should also be causing issues when not connected via usb.

@MaximumOctopus
Copy link

@MaximumOctopus MaximumOctopus commented May 1, 2022

FWIW, I've also noticed this issue (just now). When powered via USB from a laptop, the core1 code isn't executing. When powered by 5V via VBus and GND, both cores work as expected. If I power it via the USB port from one of those cheap rechargeable battery power banks (£1 from poundstretcher) it also works as expected.

The code I'm using is very simple. Two LEDs flashing at different rates, one per core. I'm using a framework very similar to the OP's code, plus a flasher (on, delay, off, delay) in loop().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants