I'm using I2S to extract data from ADC at 32bit 128KHz 2CH.
I'm trying to send the raw data over a WiFi socket to a .NET C# Winform application that just collects the data in an array
I'm experiencing occasional data loss, but I'm not even sure which side is at fault (PC or ESP).
What is the recommended I2S buffer size ?
What is the recommended number of bytes to send to the socket at each write command ?
Can you please issue any other advice ?
I2S to WIFI
-
- Posts: 17
- Joined: Wed Jul 25, 2018 8:11 am
Re: I2S to WIFI
Q:What is the recommended I2S buffer size ?
A:I think the larger the better.
Q:What is the recommended number of bytes to send to the socket at each write command ?
A: Maybe 1450? or use 1024 directly? I think it depends on your code.
A:I think the larger the better.
Q:What is the recommended number of bytes to send to the socket at each write command ?
A: Maybe 1450? or use 1024 directly? I think it depends on your code.
Re: I2S to WIFI
Along with 1024 buffer sizes I recommend using queues to move data between an I2S reading task and an IP sending task. Also you failed to mention the type of socket. It should be TCP. My experience with the ESP32 is that you can expect a lot of lost packets in a congested wifi environment. So if you use datagram sockets then you will lose data.
John A
John A
-
- Posts: 5
- Joined: Fri May 18, 2018 5:26 am
Re: I2S to WIFI
i2s_read(ADC_I2S_NUM,(char*) &i2s_read_buff[0],i2s_read_len,&bytes_read,portMAX_DELAY);
EventBits_t uxBits=xEventGroupGetBits(xHMEventGroup);
if( ( uxBits & BIT_xHMEventGroup_sendRaw2Socket ) == BIT_xHMEventGroup_sendRaw2Socket ){
if(xQueuePeek(xQueueSocket, &s, 100 ))
{
bytes_sent = write(s , (char*) &i2s_read_buff[0] , bytes_read);
}
else {
xEventGroupClearBits(xHMEventGroup,BIT_xHMEventGroup_sendRaw2Socket);
}
}
}
free(i2s_read_buff);
vTaskDelete(NULL);
}
Separating it to read & write tasks is a good idea, i'll try it but I can't send the whole data via queue.
I'm using TCP socket.
EventBits_t uxBits=xEventGroupGetBits(xHMEventGroup);
if( ( uxBits & BIT_xHMEventGroup_sendRaw2Socket ) == BIT_xHMEventGroup_sendRaw2Socket ){
if(xQueuePeek(xQueueSocket, &s, 100 ))
{
bytes_sent = write(s , (char*) &i2s_read_buff[0] , bytes_read);
}
else {
xEventGroupClearBits(xHMEventGroup,BIT_xHMEventGroup_sendRaw2Socket);
}
}
}
free(i2s_read_buff);
vTaskDelete(NULL);
}
Separating it to read & write tasks is a good idea, i'll try it but I can't send the whole data via queue.
I'm using TCP socket.
Who is online
Users browsing this forum: No registered users and 175 guests