Thanks for the advice dsl, I changed my transmission buffer to 2340 bytes (just enough for a single buffer of 1170 samples). Had to add a small delay after the send command to make it work (~17 Mbits/sec), but it seems that my PC is not keeping up to the speed :cry:
case 67:
printf("Continuous acquisition! \n");
//////////////////////////////////////////////////////////
// Continuous acquisition loop (ASCII code = 67)
//////////////////////////////////////////////////////////
//for (iLines = 1; iLines <= nLines; iLines++)
while(1)
{
//////////////////////////////////////////////////////////
// Send single A-line
//////////////////////////////////////////////////////////
// Wait to finish writing acquired data to the RAM
do
{
acq_busy_signal = IORD_ALTERA_AVALON_PIO_DATA(ACQ_BUSY_PIO_BASE);
// look definitions in ..software\simple_socket_server\simple_socket_server_syslib\Debug\system_description\system.h
}
while (acq_busy_signal == 1);
// Indicate that we are busy reading RAM contents
read_RAM_busy = 1;
IOWR_ALTERA_AVALON_PIO_DATA(READ_RAM_BUSY_PIO_BASE, read_RAM_busy);
// Begin the transfer
tx_wr_pos = tx_buf;
for (RAM_address = 1; RAM_address <= NSAMPLES; RAM_address++)
{
// Read data port (from RAM)
ADC_data = IORD_ALTERA_AVALON_PIO_DATA(ADC_DATA_PIO_BASE);
// Write address port (to RAM)
IOWR_ALTERA_AVALON_PIO_DATA(READ_RAM_ADDRESS_BASE, RAM_address + 1);
dataPointer = (unsigned char*)&ADC_data;
// Send 16-bit data (swapped upper and lower bytes)
*tx_wr_pos++ = dataPointer;
*tx_wr_pos++ = dataPointer;
} // END for (RAM_address = 0; RAM_address <= NSAMPLES; RAM_address++)
bytes_sent = send(conn->fd, tx_buf, tx_wr_pos - tx_buf, 0);
//printf("L:%d BS: %d\n",iLines,bytes_sent);
// Indicate that we are done reading RAM contents
read_RAM_busy = 0;
IOWR_ALTERA_AVALON_PIO_DATA(READ_RAM_BUSY_PIO_BASE, read_RAM_busy);
//////////////////////////////////////////////////////////
// single A-line transfer done!
//////////////////////////////////////////////////////////
// Wait a little... Should know why...
for (RAM_address = 1; RAM_address <= NSAMPLES; RAM_address++);
} // END of continuous acquisition loop
break;
Any ideas how to know if the packet was received in the PC?