HELP REQUEST !!
I’m not working on a real project, but evaluating the new processors.
I use different approaches to generate a sine wave (I2C, SPI, I2S. .. )
In this moment I'm using a 10-bit SPI DAC 5V
I use the same simple SW for testing the different processors.
I can share the following results I have got
Arduino uno Sine WAVE 101,6Hz
Teensy 4.1 Sine WAVE 2,57khZ
PI_PICO Sine WAVE 53,35 Hz (processor speed 125 MHZ)
Good news: I'm able to generate a sine wave with a SPI DAC and the Pi PICO
Bad news: The sine frequency is smaller than the one I got with Arduino Uno
My expectation was to generate a Sine with a frequency between the one with Arduino Uno and the Teensy 4.1 one.
What’s wrong in my thoughts with PI PICO ?
Any hint would be great appreciated!!!
SW used
/*
A demo of the TLC5615 10-bit SPI DAC with Arduino Uno
Generates a test sine wave, rising ramp wave, and
some custom voltage outputs for hardware testing.
Gadget Reboot
*/
#include <Wire.h>
#include <TLC5615.h>
// SPI chip select pin
#define dac_CS 17
// current position in waveform/sample playback
int sinePos = 0;
// create DAC object using chosen chip select pin
TLC5615 dac(dac_CS);
// sine wave data table generated with Sine Look Up Table Generator Calculator
const PROGMEM uint16_t sineTable[256] =
{
512, 524, 537, 549, 562, 574, 587, 599,
611, 624, 636, 648, 660, 672, 684, 696,
707, 719, 730, 741, 753, 764, 774, 785,
796, 806, 816, 826, 836, 846, 855, 864,
873, 882, 890, 899, 907, 915, 922, 930,
937, 944, 950, 957, 963, 968, 974, 979,
984, 989, 993, 997, 1001, 1004, 1008, 1011,
1013, 1015, 1017, 1019, 1021, 1022, 1022, 1023,
1023, 1023, 1022, 1022, 1021, 1019, 1017, 1015,
1013, 1011, 1008, 1004, 1001, 997, 993, 989,
984, 979, 974, 968, 963, 957, 950, 944,
937, 930, 922, 915, 907, 899, 890, 882,
873, 864, 855, 846, 836, 826, 816, 806,
796, 785, 774, 764, 753, 741, 730, 719,
707, 696, 684, 672, 660, 648, 636, 624,
611, 599, 587, 574, 562, 549, 537, 524,
512, 499, 486, 474, 461, 449, 436, 424,
412, 399, 387, 375, 363, 351, 339, 327,
316, 304, 293, 282, 270, 259, 249, 238,
227, 217, 207, 197, 187, 177, 168, 159,
150, 141, 133, 124, 116, 108, 101, 93,
86, 79, 73, 66, 60, 55, 49, 44,
39, 34, 30, 26, 22, 19, 15, 12,
10, 8, 6, 4, 2, 1, 1, 0,
0, 0, 1, 1, 2, 4, 6, 8,
10, 12, 15, 19, 22, 26, 30, 34,
39, 44, 49, 55, 60, 66, 73, 79,
86, 93, 101, 108, 116, 124, 133, 141,
150, 159, 168, 177, 187, 197, 207, 217,
227, 238, 249, 259, 270, 282, 293, 304,
316, 327, 339, 351, 363, 375, 387, 399,
412, 424, 436, 449, 461, 474, 486, 499
};
void setup() {
// initialize DAC
dac.begin();
}
void loop() {
// sine wave
dac.analogWrite(pgm_read_word(&(sineTable[sinePos])));
sinePos++;
if (sinePos >= 256)
sinePos = 0;
}
HARDWARE USED FOR THE TEST
PI PICO & TLC5615 10-bit SPI DAC (level shifter is required)

