From bdd1de1b0258ccfd55459e53212b0ce84e37fe57 Mon Sep 17 00:00:00 2001 From: "adam@algroup.co.uk" Date: Thu, 4 Feb 2010 23:15:53 +0000 Subject: [PATCH] make LF sampling ACK to fix USB timing issue in em410xwatch --- armsrc/appmain.c | 4 +++- client/cmdlf.c | 1 + client/cmdmain.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index ecf22adf..f69bdccc 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -568,11 +568,14 @@ void ListenReaderField(int limit) void UsbPacketReceived(BYTE *packet, int len) { UsbCommand *c = (UsbCommand *)packet; + UsbCommand ack; switch(c->cmd) { #ifdef WITH_LF case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K: AcquireRawAdcSamples125k(c->arg[0]); + ack.cmd = CMD_ACK; + UsbSendPacket((BYTE*)&ack, sizeof(ack)); break; #endif @@ -719,7 +722,6 @@ void UsbPacketReceived(BYTE *packet, int len) } case CMD_DOWNLOADED_SIM_SAMPLES_125K: { - UsbCommand ack; BYTE *b = (BYTE *)BigBuf; memcpy(b+c->arg[0], c->d.asBytes, 48); //Dbprintf("copied 48 bytes to %i",b+c->arg[0]); diff --git a/client/cmdlf.c b/client/cmdlf.c index e82e48ae..26bd5e4f 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -266,6 +266,7 @@ int CmdLFRead(const char *Cmd) return 0; } SendCommand(&c); + WaitForResponse(CMD_ACK); return 0; } diff --git a/client/cmdmain.c b/client/cmdmain.c index 3cdcd089..30b431f5 100644 --- a/client/cmdmain.c +++ b/client/cmdmain.c @@ -125,6 +125,7 @@ void UsbCommandReceived(UsbCommand *UC) for(i=0; i<48; i++) sample_buf[i] = UC->d.asBytes[i]; received_command = UC->cmd; return; + case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K: case CMD_DOWNLOADED_SIM_SAMPLES_125K: if (UC->cmd != CMD_ACK) goto unexpected_response; // got ACK -- 2.39.5