In the following line both tx and rx buffer are being set to the same pointer. The controller while being write only still returns something and overrides the tx buffer which will mess up subsequent calls. I think we should discard the tx buffer here
tr.rx_buf = 0;
|
tr.rx_buf = (unsigned long)buf; |