ESP8266 I2S signal generator

Hello,

I'm trying to set up ESP8266 I2S RX pin signal generator from

https://github.com/roberttidey/espI2sClockGen

but I receive

'i2scSetMSArrayItem' was not declared in this scope compile error. What could be the issue ? I have all the required libraries installed.

The issue clearly described in the error message.
Where you get the code from?

Code is at

https://www.instructables.com/Esp8266-Clock-and-Pulse-Generator/

It is also on the github link I sent.

According to the error, you have not installed "i2sTXcircular.h" library

Library is installed. I've tested this basic code bellow with the same init, just to see if library is working fine. And it works. But the original code doesn't.

#define ESP8266
#include <arduino.h>
#include <i2sTXcircular.h>

void setup() {
  // Initialize I2S clock generator
  i2scInit(512, 16000000 / (Div1 * Div2), Div1, 0, 0);
  // Buffer size: 512, Clock rate determined by Div1 and Div2, 16 MHz base clock

  // Set mark and space durations directly
  i2scSetMSArrayItem(0, 1, 1, 0);
  // Mark bits: 4, Space bits: 4, Repeat: 0

  // Begin I2S clock generation
  i2scBegin();
}

void loop() {
}

Please show a full IDE output with error message

Unfortunately, I'm getting too many error messages so I will try to generate frequency manually.

#define ESP8266
#include <arduino.h>
#include <i2sTXcircular.h>

void setup() {
  
  // Initialize I2S clock generator
  i2scInit(512, 16000000, -1, 0, 0);  // 1MHZ
  //i2scInit(512, 8000000, -1, 0, 0);  // 500khz

  // Set mark and space durations directly
  i2scSetMSArrayItem(0, 4, 4, 0);
  // Mark bits: 4, Space bits: 4, Repeat: 0

  // Begin I2S clock generation
  i2scBegin();
}

void loop() {
 }

I've managed to generate 1mhz and 500khz using this code above. How can I use i2scInit initialiser to build a function that will generate a desired frequency ? I need a range from 10hz to 1mhz.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.