xxxajk
Well-known member
Where's the link ?![]()
It isn't available for public consumption yet.
There are many interface drivers that need to be moved to the new API.
I'm considering an alpha release in the next week or two.
Where's the link ?![]()
void serial3_putchar(uint32_t c)
{
uint32_t head;
if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return;
if (transmit_pin) *transmit_pin = 1;
head = tx_buffer_head;
if (++head >= TX_BUFFER_SIZE) head = 0;
while (tx_buffer_tail == head) {
int priority = nvic_execution_priority();
if (priority <= IRQ_PRIORITY) {
if ((UART2_S1 & UART_S1_TDRE)) {
uint32_t tail = tx_buffer_tail;
[B][COLOR="#FF0000"] if (++tail >= TX_BUFFER_SIZE) tail = 0;
UART2_D = tx_buffer[tail];[/COLOR][/B]
tx_buffer_tail = tail;
}
} else if (priority >= 256) {
yield(); // wait
}
}
tx_buffer[head] = c;
transmitting = 1;
tx_buffer_head = head;
UART2_C2 = C2_TX_ACTIVE;
}
void serial2_putchar(uint32_t c)
{
uint32_t head, n;
if (!(SIM_SCGC4 & SIM_SCGC4_UART1)) return;
if (transmit_pin) *transmit_pin = 1;
head = tx_buffer_head;
if (++head >= TX_BUFFER_SIZE) head = 0;
while (tx_buffer_tail == head) {
int priority = nvic_execution_priority();
if (priority <= IRQ_PRIORITY) {
if ((UART1_S1 & UART_S1_TDRE)) {
uint32_t tail = tx_buffer_tail;
[B][COLOR="#FF0000"] if (++tail >= TX_BUFFER_SIZE) tail = 0;
n = tx_buffer[tail];
if (use9Bits) UART1_C3 = (UART1_C3 & ~0x40) | ((n & 0x100) >> 2);
UART1_D = n;
[/COLOR][/B] tx_buffer_tail = tail;
}
} else if (priority >= 256) {
yield(); // wait
}
}
tx_buffer[head] = c;
transmitting = 1;
tx_buffer_head = head;
UART1_C2 = C2_TX_ACTIVE;
}
Arrrrgggg.... I thought I fixed that.
Please post the code and I'll give it a try here. Looks like "beta8" might be coming sooner rather than later!
T_FFT_SINEWAVE_edit.ino.ino: In function 'void loop()':
Error compiling.
Same errors other UDP sketches/Users/admin/Documents/Arduino/libraries/Ethernet/utility/socket.cpp:295:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
W5100.read_data(s,(uint8_t*)ptr,head,2);
^
/Users/admin/Documents/Arduino/libraries/Ethernet/utility/socket.cpp:300:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
W5100.read_data(s,(uint8_t*) ptr,buf,data_len);
^
/Users/admin/Documents/Arduino/libraries/Ethernet/utility/socket.cpp: In function 'uint16_t igmpsend(SOCKET, const uint8_t*, uint16_t)':
/Users/admin/Documents/Arduino/libraries/Ethernet/utility/socket.cpp:316:11: warning: variable 'status' set but not used [-Wunused-but-set-variable]
uint8_t status=0;
^
/Users/admin/Documents/Arduino/libraries/Ethernet/utility/w5100.cpp: In member function 'void W5100Class::recv_data_processing(SOCKET, uint8_t*, uint16_t, uint8_t)':
/Users/admin/Documents/Arduino/libraries/Ethernet/utility/w5100.cpp:101:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
read_data(s, (uint8_t *)ptr, data, len);
so, a complete fresh start by deleting any traces of old IDE and ethernet files, reload with 1.6 and beta7, and swapped ethernet folder for the one manitou has available: https://github.com/manitou48/teensy3regarding 1.6 with 1.21 beta7, still trying to sort through ethernet issues.
tried v1.6 with audio library and teensyduino beta 7. Did not work with audio mixer very well.
// Simple WAV file player example
//
// Requires the audio shield:
// http://www.pjrc.com/store/teensy3_audio.html
//
// Data files to put on your SD card can be downloaded here:
// http://www.pjrc.com/teensy/td_libs_AudioDataFiles.html
//
// This example code is in the public domain.
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
//////////////////////////////////////////////////////////////////////////
//////////////////////// Audio Setup ///////////////////////////
AudioPlaySdRaw raw4; //channel 4 playback
AudioPlaySdRaw raw3; //channel 4 playback
AudioPlaySdRaw raw2; //channel 4 playback
AudioPlaySdRaw raw1; //channel 4 playback
AudioMixer4 mixer1; //combines up to 4 channels, can play even more if needed by more mixers
AudioOutputI2S i2s; //I2S type playback (opposed to I2C etc)
AudioConnection patchCord1(raw1, 0, mixer1, 0);
AudioConnection patchCord2(raw2, 0, mixer1, 1);
AudioConnection patchCord3(raw3, 0, mixer1, 2);
AudioConnection patchCord4(raw4, 0, mixer1, 3);
AudioConnection patchCord5(mixer1, 0, i2s, 0);
AudioControlSGTL5000 sgtl5000; //audio codec chip
//////////////////////////////////////////////////////////////////////////
byte count;
int rate = 100;
void setup() {
Serial.begin(9600);
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(15);
sgtl5000.enable();
sgtl5000.volume(0.5);
SPI.setMOSI(7);
SPI.setSCK(14);
if (!(SD.begin(10))) {
// stop here, but print a message repetitively
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
//f1= SD.open("R01.LTP");
//Serial.println(f1);
}
void playFile(const char *filename)
{
//Serial.print("Playing file: ");
//Serial.println(filename);
// Start playing the file. This sketch continues to
// run while the file plays.
count++;
if (count > 4)
{
count = 1;
}
Serial.print("c");
Serial.print(count);
Serial.print(" ");
switch (count)
{
case 1:
//raw1.stop();
raw1.play(filename);
break;
case 2:
//raw2.stop();
raw2.play(filename);
break;
case 3:
//raw3.stop();
raw3.play(filename);
break;
case 4:
// raw4.stop();
raw4.play(filename);
break;
default:
delay(2000);
break;
}
//Serial.print(AudioProcessorUsage());
Serial.print("maxCPU: ");
Serial.print(AudioProcessorUsageMax());
Serial.print(" ");
Serial.print("Memory: ");
//Serial.print(AudioMemoryUsage());
//Serial.print(",");
Serial.println(AudioMemoryUsageMax());
// A brief delay for the library read WAV info
//delay(50);
// Simply wait for the file to finish playing.
//while ()//playRaw.isPlaying()) {
// uncomment these lines if you audio shield
// has the optional volume pot soldered
//float vol = analogRead(15);
//vol = vol / 1024;
// sgtl5000_1.volume(vol);
//}
}
void loop() {
playFile("R01.LTP");
delay(rate);
playFile("A26.LTP");
delay(rate);
playFile("V38.LTP");
delay(rate);
playFile("H10.LTP");
delay(rate);
}
I've mentioned the same in the Artnet thread. The Ethernt library manitou posted is very only and from a distant past before Paul integrated the W5200 auto detect into the Ethernet library. I've used it myselffor a while. It most certainly does not have support for the SPI transactions so may not play very well with other libraries.so, a complete fresh start by deleting any traces of old IDE and ethernet files, reload with 1.6 and beta7, and swapped ethernet folder for the one manitou has available: https://github.com/manitou48/teensy3
and seems to be compiling again.
I also used RAW files, but can easily replace all the RAW words with WAV to switch to wav format.
Can you send me those 4 files, so I can test with the same data?
Maybe use dropbox if they're too big to post here in zip files...
My SD card has about 750 wav files on it. When you have a lot of files, for some reason, at high rate of playback, say opening a file every 100ms, there becomes a lot of problems... Squeek on file open, some files wont play/mix, otherwise it depends on the file or order on the card... Seems to go away completely with say less than 20 files on the card... not really a solution for me.
Oh, that makes sense. The play object is opening the file each time. The Arduino SD library probably has to read all the directory sectors leading up to that file, which can be a LOT of data if you have hundreds of files and especially if many of them have long names.
Perhaps a future version should have a way to keep the file open and simply seek back to the beginning. More investigation into that the SD library really does is also needed. All things to look into for the next version.....
I've filed this as an issue, so it won't be forgotten when I work on the audio lib again later this year.
https://github.com/PaulStoffregen/Audio/issues/109