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

It crashes..... #31

Open
frohro opened this issue Mar 2, 2024 · 1 comment
Open

It crashes..... #31

frohro opened this issue Mar 2, 2024 · 1 comment

Comments

@frohro
Copy link

frohro commented Mar 2, 2024

I click the teleplot button, and it opens teleplot. I then choose /dev/ttyACM0 on the serial menu. When I click open, nothing happens until I get a window saying it clashed. It asked if I wanted to submit a report about VScode crashing, so I did, but it seems to be a problem with teleplot. I was sending serial data using the USB ACM-CDC model from a raspberry pi pico using Earl Philhower's Arduino Pico library at about 3 Mbit/s or so. The serial monitor works fine, but of course does not plot. I am new to this so I'm not sure my code has the teleplot initialization. If I leave it like I would with the the Arduino IDE it just crashes. If I add a Serial.print(">Left: "); ahead of the Serial.println() statement it runs a while plotting, but then crashes. I think it may be slowing down or missing my data while it is briefly running. I'm tryinig to plot I2S data from a PCM1808. It works from the Arduino IDE fine. I'll paste it here since github doesn't seem to allow pasting a .cpp file.

`/*
I2S stereo microphone (input) example
Run using the Arduino Serial Plotter to see waveform.
Released to the Public Domain by Earle F. Philhower, III

For the Google AIY Voice Hat Microphone daughterboard, part
of the Raspberry Pi AIY cardboard box, the I2S stereo pinout
looking at the board top with the RPI logo on the left hand
side:
+-- ------------------------------------ --+
left RPI | (1) GND (2) DIN (3) BCLK (4) LRCLK (5) 3.3V | AIY right
logo +---------------------------------------------+ logo

For an Adfruit I2S MEMS microphone (https://www.adafruit.com/product/3421),
connect the pins as follows:

  DOUT -> GPIO0
  BCLK <- GPIO1
  LRCL <- GPIO2  # LRCLK = BCLK + 1
  GND <-> GND
  3V  <-> 3V3OUT

The other idiosyncrasy of most modern MEMS microphones is that they
require a minimum clock rate to wake up. For example, the SPH0645
microphone needs at least 1MHz.
*/
#include <I2S.h>

#define RATE 16000
#define MCLK_MULT 256 // 384 for 48 BCK per framme, 256 for 64 BCK per frame

I2S i2s(INPUT);

void setup() {
Serial.begin();

i2s.setDATA(2);
i2s.setBCLK(0);
i2s.setMCLK(3);
// Note: LRCK pin is BCK pin plus 1 (1 in this case).
i2s.setBitsPerSample(24);
i2s.setFrequency(RATE);
i2s.setMCLKmult(MCLK_MULT);
i2s.setSysClk(RATE);
i2s.setBuffers(32,0,0);

i2s.begin();
}

void loop() {
static int32_t r, l;
i2s.read32(&l, &r);
Serial.print(">left:");
Serial.printf("%d \r\n", l<<9); // This only works up 16 kHz.
}
`

@AmberElferink
Copy link

I found vscode crashing is an issue if you send data at a too high rate indeed. Serial prints worked reliable for me up to 1Khz without vscode crashing

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

2 participants