Tiny 2040 - a tiny RP2040 stamp

Anything not related to STM32
User avatar
Pito
Posts: 94
Joined: Tue Dec 24, 2019 1:53 pm

Tiny 2040 - a tiny RP2040 stamp

Post by Pito »

Pukao Hats Cleaning Services Ltd.
BennehBoy
Posts: 135
Joined: Sat Jan 04, 2020 2:38 am
Answers: 1

Re: Tiny 2040 - a tiny RP2040 stamp

Post by BennehBoy »

!
RachelAvery
Posts: 1
Joined: Thu May 13, 2021 3:07 pm

Re: Tiny 2040 - a tiny RP2040 stamp

Post by RachelAvery »

Nice one! By the way, the channel is very interesting, there are quite a lot of such videos. The author tells very detailed about everything!!!
Last edited by RachelAvery on Fri May 14, 2021 6:20 pm, edited 1 time in total.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Tiny 2040 - a tiny RP2040 stamp

Post by ag123 »

!
dannyf
Posts: 447
Joined: Sat Jul 04, 2020 7:46 pm

Re: Tiny 2040 - a tiny RP2040 stamp

Post by dannyf »

what's the point of shrinking such a powerful chip into this tiny of a package?

would someone by a Xeon processor in SOT23 package? a ARM M3? ...
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Tiny 2040 - a tiny RP2040 stamp

Post by ag123 »

well m0 isn't quite that 'powerful', tiny form factors is cool.just that soldering etc multiply many times in difficulty
i'd imagine the more appropriate pin spacing for small form factor boards would be 1.25mm (1/20") and connectors would be the fpc sorts.
compact form factors could meet the needs of smart watches and fitness trackers, where the whole pcb etc needs to fit in a area smaller than the wrist say like 1"x1" (25.4mm x 25.4mm) and possibly smaller
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Tiny 2040 - a tiny RP2040 stamp

Post by mrburnette »

ag123 wrote: Mon May 17, 2021 9:29 am someone is pretty quick
https://github.com/earlephilhower/arduino-pico

oh and the original arduino isn't too far behind
https://github.com/arduino/ArduinoCore- ... /tag/2.0.0
https://www.tomshardware.com/news/raspb ... o-official
RP2040 Pico Multicore IDE.JPG
RP2040 Pico Multicore IDE.JPG (42.43 KiB) Viewed 5393 times
So ...
Using IDE 2.0.0-beta.6 and both references, Earl's and Official, the Official is strictly MBED.
Earl's core is going to look like generic Arduino, that is, like Roger's core for STM32F1xx

Using Earl's core and the IDE 2 beta, I have gotten the Pico code to compile, load, and enumerate the USB properly under Windows 10.

Code: Select all

// https://forum.arduino.cc/t/multicore-on-raspberry-pi-pico/858908/8
/*
  From (https://arduino-pico.readthedocs.io/en/latest/multicore.html)
  
  By adding a setup1() and loop1() function to your sketch you can make use of the second core. 
  Anything called from within the setup1() or loop1() routines will execute on the second core.

  Functions:
  1) Pausing Cores
  - void rp2040.idleOtherCore();
  - void rp2040.resumeOtherCore();

  2) Communicating Between Cores
  - void rp2040.fifo.push(uint32_t);
  - bool rp2040.fifo.push_nb(uint32_t);
  - bool rp2040.fifo.push_nb(uint32_t);
  - bool rp2040.fifo.pop_nb(uint32_t *dest);
  - int rp2040.fifo.available();
*/

#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/multicore.h"

#define FLAG_VALUE 0xDEADBEEF

void heartBeatPrint(bool isCore0 = true) {
  static int num = 1;

  Serial.print(isCore0 ? F("C0") : F("C1"));

  if (num == 40) {
    Serial.println();
    num = 1;
  } else if (num++ % 10 == 0) {
    Serial.print(F(" "));
  }
}

void check_status(bool isCore0 = true) {
  static unsigned long checkstatus_timeout = 0;

#define STATUS_CHECK_INTERVAL 10000L

  // Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0)) {
    heartBeatPrint(isCore0);
    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
  }
}

//////////////////////////////////////////////

// Running on Core0

void setup() {
  rp2040.idleOtherCore();

  Serial.begin(115200);
  while (!Serial)
    ;

  Serial.print("\nStart RPI_Pico_Multicore Core0 on ");
  Serial.println("BOARD_NAME");

  rp2040.resumeOtherCore();

  uint32_t g = rp2040.fifo.pop();

  rp2040.idleOtherCore();

  Serial.print("C0: rp2040_fifo_pop g = 0x");
  Serial.println(g, HEX);

  if (g == FLAG_VALUE) {
    rp2040.fifo.push(FLAG_VALUE);
    Serial.println("Core0 OK!");
  } else
    Serial.println("Core0 not OK!");

  rp2040.resumeOtherCore();
}

void loop() {
  check_status(true);
}

//////////////////////////////////////////////

// Running on Core1

void core1_entry() {
  rp2040.fifo.push(FLAG_VALUE);

  uint32_t g = rp2040.fifo.pop();

  rp2040.idleOtherCore();

  Serial.print("C1: rp2040_fifo_pop g = 0x");
  Serial.println(g, HEX);

  if (g == FLAG_VALUE)
    Serial.println("Core1 OK!");
  else
    Serial.println("Core1 not OK!");

  rp2040.resumeOtherCore();
}

void setup1() {
  rp2040.idleOtherCore();

  Serial.begin(115200);
  while (!Serial)
    ;

  Serial.print("Start RPI_Pico_Multicore Core1 on ");
  Serial.println("BOARD_NAME");

  rp2040.resumeOtherCore();

  core1_entry();
}

void loop1() {
  check_status(false);
}
Sketch uses 56928 bytes (2%) of program storage space. Maximum is 2093056 bytes.
Global variables use 12128 bytes (4%) of dynamic memory, leaving 250016 bytes for local variables. Maximum is 262144 bytes.

--------------------------
Compilation complete.
Waiting for upload port...
No upload port found, using COM4 as fallback
"C:\Users\Ray\AppData\Local\Arduino15\packages\rp2040\tools\pqt-python3\1.0.1-base-3a57aed/python3" "C:\Users\Ray\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.4.0/tools/uf2conv.py" --serial "COM4" --family RP2040 --deploy "C:\Users\Ray\AppData\Local\Temp\arduino-sketch-68FFB3D64767CCF49049EAEA9C386380/multicore_test_2.ino.uf2"
Resetting COM4
Converting to uf2, output size: 128000, start address: 0x2000
Flashing D: (RPI-RP2)
Wrote 128000 bytes to D:/NEW.UF2

--------------------------
upload complete.


New Line
115200 baud

Start RPI_Pico_Multicore Core0 on BOARD_NAME
Start RPI_Pico_Multicore Core1 on BOARD_NAME
C0: rp2040_fifo_pop g = 0xDEADBEEF
Core0 OK!
C1: rp2040_fifo_pop g = 0xDEADBEEF
Core1 OK!
C1C0C1C0C0C1C1C0C0C1
Personal note: On my 4-core i7 6820HQ with 8G RAM,
the IDE + compile + upload = damn-slow
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Tiny 2040 - a tiny RP2040 stamp

Post by ag123 »

imho IDE 2.0 is kind of still 'embryonic' there seemed to be lots of problems including one related to pathname length limitations (this one is serious as relevant class paths get truncated), this is more os related as it happens in windows.
i've logged an issue related to undeclared idenfiers and missing reference jumps for stm32 core(s), it turns out that has to do with clangd
if arduino-cli compile is run with --only-compilation-database ends in error, compile_commands.json is not generated
viewtopic.php?p=6586#p6586

i'm not sure if that's fixed (yet)
and IDE 2.0 use a huge amount of space some 800+ megs to install.
AndrewBCN
Posts: 105
Joined: Sun Apr 25, 2021 3:50 pm
Answers: 1
Location: Strasbourg, France

Re: Tiny 2040 - a tiny RP2040 stamp

Post by AndrewBCN »

I am still trying to think of a single use case where the RP2040 would be a better choice than any member of the STM32 family, whether for a maker or for an engineer designing a product for industrial use.
Also in terms of development tools and ease of use, the STM32 family is light years ahead.
Btw I am an RPi 4 fan. Fantastic, extremely powerful SBC for as little as $35 (but I suggest going for the 4Gb version for as little as $55, and a USB M.2 drive for $40 more).
The RP2040, meh...
Post Reply

Return to “Off topic”