Hi,
I am developing an audio recording system using Raspberry Pi B+.
To guarantee the sampling rate, an external GPIO interrupt with 16 kHz was implemented.
Then, for each interrupt, A/D conversion having 16-bit resolution was followed to get a sample.
Finally, for every 100ms, the buffered 1600 samples were transmitted to the server PC by applying TCP/IP-based communications.
However, I found that several samples were missed whenever the buffered samples were transmitted by TCP/IP.
I doubt that the GPIO interrupt for A/D conversion was missed whenever the TCP/IP socket communications are executed.
The core program codes written in C are as follows.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
struct sockaddr_in server_addr;
//External GPIO interrupt setting
wiringPiSetup();
pinMode(5, INPUT);
wiringPiISR(5, INT_EDGE_FALLING, &ISR);
//Setting for TCP/IP socket communications
Socket = socket(AF_INET, SOCK_DGRAM, 0);
bzero((char *)&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr("192.168.0.3");
server_addr.sin_port = htons(8101);
connect(Socket, (struct sockaddr *)&server_addr, sizeof(server_addr);
while(1)
{
//Buffered samples transmitting
if(buffFullFlag == TRUE) write(Socket, buf0, BUF_LEN*sizeof(unsigned short));
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The attached file shows an example of the waveform of transmitted data.
Could you tell me the reason and solution about my problem ??