It should work.... otherwise a lot of TX distortion occurs. i have added a print statement in the past in the firmware... will check it later.
int write_iq_sample(unsigned char tx_iqdata[]){
uint32_t value = 0;
int i = 0;
for (i = 0; i < 4 ; i++) {
if (tx_iqdata[i] & 0x80) *rpi_set_io_high = (1<<17); else *rpi_set_io_low = (1<<17);
if (tx_iqdata[i] & 0x40) *rpi_set_io_high = (1<<5); else *rpi_set_io_low = (1<<5);
if (tx_iqdata[i] & 0x20) *rpi_set_io_high = (1<<18); else *rpi_set_io_low = (1<<18);
if (tx_iqdata[i] & 0x10) *rpi_set_io_high = (1<<12); else *rpi_set_io_low = (1<<12);
*rpi_set_io_high = (1<<RPI_TX_CLK);
if (tx_iqdata[i] & 0x08) *rpi_set_io_high = (1<<17); else *rpi_set_io_low = (1<<17);
if (tx_iqdata[i] & 0x04) *rpi_set_io_high = (1<<5); else *rpi_set_io_low = (1<<5);
if (tx_iqdata[i] & 0x02) *rpi_set_io_high = (1<<18); else *rpi_set_io_low = (1<<18);
if (tx_iqdata[i] & 0x01) *rpi_set_io_high = (1<<12); else *rpi_set_io_low = (1<<12);
*rpi_set_io_low = (1<<RPI_TX_CLK);
}
// get the tx fifo state
// if tx fifo is full; than a 0 is returned otherwise 1.
// the sleep is in firmware... i think it should be long here... but delay in kernel mode
// is not working properly....
// to do... i like to solve it in the driver.
value = *rpi_read_io;
return ((value >> 7) & 1);
}
firmware:
if (! write(fd_rb , tx_iqdata , sizeof(tx_iqdata))) {
// tx FIFO is almost full; we give 50 sample time...
// prefer to have this sleep in the driver...did not get it to work properly!
usleep(1000); //50 samples sleep (1/48K about 20usec /sample * 50)
}