mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
First adjustments for FPC BT link
This commit is contained in:
parent
dda63f9556
commit
e453aff88c
4 changed files with 19 additions and 2 deletions
|
@ -491,7 +491,14 @@ void pm3_version(bool verbose) {
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandOLD(CMD_VERSION, 0, 0, 0, NULL, 0);
|
SendCommandOLD(CMD_VERSION, 0, 0, 0, NULL, 0);
|
||||||
|
#ifdef USART_SLOW_LINK
|
||||||
|
// 10s timeout for slow FPC, e.g. over BT
|
||||||
|
// as this is the very first command sent to the pm3
|
||||||
|
// that initiates the BT connection
|
||||||
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 10000)) {
|
||||||
|
#else
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
||||||
|
#endif
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
PrintAndLogEx(NORMAL, "\n [ Proxmark3 RFID instrument ]\n");
|
PrintAndLogEx(NORMAL, "\n [ Proxmark3 RFID instrument ]\n");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -421,7 +421,7 @@ __attribute__((force_align_arg_pointer))
|
||||||
PacketResponseOLD rx_old;
|
PacketResponseOLD rx_old;
|
||||||
memcpy(&rx_old, &rx_raw.pre, sizeof(PacketResponseNGPreamble));
|
memcpy(&rx_old, &rx_raw.pre, sizeof(PacketResponseNGPreamble));
|
||||||
if ((!uart_receive(sp, ((uint8_t *)&rx_old) + sizeof(PacketResponseNGPreamble), sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble), &rxlen)) || (rxlen != sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble))) {
|
if ((!uart_receive(sp, ((uint8_t *)&rx_old) + sizeof(PacketResponseNGPreamble), sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble), &rxlen)) || (rxlen != sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble))) {
|
||||||
PrintAndLogEx(WARNING, "Received packet frame error var part too short? %d/%d", rxlen, sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble));
|
PrintAndLogEx(WARNING, "Received packet OLD frame payload error too short? %d/%d", rxlen, sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble));
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
|
|
@ -122,7 +122,14 @@ uint32_t usart_read_ng(uint8_t *data, size_t len) {
|
||||||
// uint32_t highest_observed_try = 0;
|
// uint32_t highest_observed_try = 0;
|
||||||
// Empirical max try observed: 3000000 / USART_BAUD_RATE
|
// Empirical max try observed: 3000000 / USART_BAUD_RATE
|
||||||
// Let's take 10x
|
// Let's take 10x
|
||||||
uint32_t maxtry = 10 * (3000000 / USART_BAUD_RATE);
|
|
||||||
|
uint32_t tryconstant = 0;
|
||||||
|
#ifdef USART_SLOW_LINK
|
||||||
|
// Experienced up to 13200 tries on BT link even at 460800
|
||||||
|
tryconstant = 50000;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint32_t maxtry = 10 * (3000000 / USART_BAUD_RATE) + tryconstant;
|
||||||
|
|
||||||
while (len) {
|
while (len) {
|
||||||
uint32_t available = usart_rxdata_available();
|
uint32_t available = usart_rxdata_available();
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#ifndef __USB_CMD_H
|
#ifndef __USB_CMD_H
|
||||||
#define __USB_CMD_H
|
#define __USB_CMD_H
|
||||||
|
|
||||||
|
// Use it e.g. when using slow links such as BT
|
||||||
|
#define USART_SLOW_LINK
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
typedef DWORD uint32_t;
|
typedef DWORD uint32_t;
|
||||||
typedef BYTE uint8_t;
|
typedef BYTE uint8_t;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue