From 28418b1bb752ab978a3f7c9b4243ac19aa60b379 Mon Sep 17 00:00:00 2001 From: Filipe Carvalho <34546039+filcarv@users.noreply.github.com> Date: Thu, 25 Jan 2024 22:38:58 +0000 Subject: [PATCH 1/3] Increased firmware version to 1.3. --- Firmware/RfidReader/app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/RfidReader/app.c b/Firmware/RfidReader/app.c index 45a1225..8d6463a 100644 --- a/Firmware/RfidReader/app.c +++ b/Firmware/RfidReader/app.c @@ -29,7 +29,7 @@ void hwbp_app_initialize(void) uint8_t hwH = 1; uint8_t hwL = 2; uint8_t fwH = 1; - uint8_t fwL = 2; + uint8_t fwL = 3; uint8_t ass = 0; /* Start core */ From 726d47bb0952e0cff3715276fd5513f677a0ece5 Mon Sep 17 00:00:00 2001 From: Filipe Carvalho <34546039+filcarv@users.noreply.github.com> Date: Thu, 25 Jan 2024 22:42:26 +0000 Subject: [PATCH 2/3] Clear tag register after the tag leaves the detection zone. Fix #7 For the ISO 11785 the register is cleared after detection because there's no indication of when the tag leaves. --- Firmware/RfidReader/app.c | 1 + Firmware/RfidReader/interrupts.c | 44 +++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Firmware/RfidReader/app.c b/Firmware/RfidReader/app.c index 8d6463a..3a733f1 100644 --- a/Firmware/RfidReader/app.c +++ b/Firmware/RfidReader/app.c @@ -202,6 +202,7 @@ void uart0_rcv_byte_callback(uint8_t byte_received) timer_type1_enable(&TCD1, TIMER_PRESCALER_DIV1024, 156, INT_LEVEL_LOW); // ~5 ms // 1 byte = 833 us @ 9600bps id_event_was_sent = false; + app_regs.REG_TAG_ID_ARRIVED = 0; } rxbuff_uart0[rxbuff_pointer++] = byte_received; diff --git a/Firmware/RfidReader/interrupts.c b/Firmware/RfidReader/interrupts.c index aaeabb3..4b8ab0f 100644 --- a/Firmware/RfidReader/interrupts.c +++ b/Firmware/RfidReader/interrupts.c @@ -39,6 +39,8 @@ ISR(PORTA_INT0_vect, ISR_NAKED) /************************************************************************/ extern bool id_event_was_sent; +uint64_t id_leaved_temp = 0; + ISR(PORTC_INT0_vect, ISR_NAKED) { if (read_TAG_IN_RANGE) @@ -51,8 +53,12 @@ ISR(PORTC_INT0_vect, ISR_NAKED) { id_event_was_sent = false; - app_regs.REG_TAG_ID_LEAVED = app_regs.REG_TAG_ID_ARRIVED; - core_func_send_event(ADD_REG_TAG_ID_LEAVED, true); + if (app_regs.REG_TAG_ID_ARRIVED != 0) // if != 0 it's a 125 KHz antenna + { + app_regs.REG_TAG_ID_LEAVED = app_regs.REG_TAG_ID_ARRIVED; + core_func_send_event(ADD_REG_TAG_ID_LEAVED, true); + app_regs.REG_TAG_ID_ARRIVED = 0; + } } } @@ -154,6 +160,8 @@ ISR(TCD1_OVF_vect, ISR_NAKED) *(((uint8_t*)(&app_regs.REG_TAG_ID_ARRIVED))+5) = 0; *(((uint8_t*)(&app_regs.REG_TAG_ID_ARRIVED))+6) = 0; *(((uint8_t*)(&app_regs.REG_TAG_ID_ARRIVED))+7) = 0; + + id_leaved_temp = app_regs.REG_TAG_ID_ARRIVED; } else { @@ -178,6 +186,12 @@ ISR(TCD1_OVF_vect, ISR_NAKED) if (app_regs.REG_TAG_ID_ARRIVED == app_regs.REG_TAG_MATCH0) { core_func_send_event(ADD_REG_TAG_ID_ARRIVED, (rxbuff_pointer == 16) ? false : true); + if (rxbuff_pointer == 30) + { + app_regs.REG_TAG_ID_ARRIVED = 0; + app_regs.REG_TAG_ID_LEAVED = 0; + } + id_event_was_sent = true; notify(app_regs.REG_NOTIFICATIONS); out0_timeout_ms = app_regs.REG_TAG_MATCH0_OUT0_PERIOD; @@ -186,6 +200,12 @@ ISR(TCD1_OVF_vect, ISR_NAKED) if (app_regs.REG_TAG_ID_ARRIVED == app_regs.REG_TAG_MATCH1) { core_func_send_event(ADD_REG_TAG_ID_ARRIVED, (rxbuff_pointer == 16) ? false : true); + if (rxbuff_pointer == 30) + { + app_regs.REG_TAG_ID_ARRIVED = 0; + app_regs.REG_TAG_ID_LEAVED = 0; + } + id_event_was_sent = true; notify(app_regs.REG_NOTIFICATIONS); out0_timeout_ms = app_regs.REG_TAG_MATCH1_OUT0_PERIOD; @@ -194,6 +214,12 @@ ISR(TCD1_OVF_vect, ISR_NAKED) if (app_regs.REG_TAG_ID_ARRIVED == app_regs.REG_TAG_MATCH2) { core_func_send_event(ADD_REG_TAG_ID_ARRIVED, (rxbuff_pointer == 16) ? false : true); + if (rxbuff_pointer == 30) + { + app_regs.REG_TAG_ID_ARRIVED = 0; + app_regs.REG_TAG_ID_LEAVED = 0; + } + id_event_was_sent = true; notify(app_regs.REG_NOTIFICATIONS); out0_timeout_ms = app_regs.REG_TAG_MATCH2_OUT0_PERIOD; @@ -202,6 +228,12 @@ ISR(TCD1_OVF_vect, ISR_NAKED) if (app_regs.REG_TAG_ID_ARRIVED == app_regs.REG_TAG_MATCH3) { core_func_send_event(ADD_REG_TAG_ID_ARRIVED, (rxbuff_pointer == 16) ? false : true); + if (rxbuff_pointer == 30) + { + app_regs.REG_TAG_ID_ARRIVED = 0; + app_regs.REG_TAG_ID_LEAVED = 0; + } + id_event_was_sent = true; notify(app_regs.REG_NOTIFICATIONS); out0_timeout_ms = app_regs.REG_TAG_MATCH3_OUT0_PERIOD; @@ -211,10 +243,16 @@ ISR(TCD1_OVF_vect, ISR_NAKED) else { core_func_send_event(ADD_REG_TAG_ID_ARRIVED, (rxbuff_pointer == 16) ? false : true); + if (rxbuff_pointer == 30) + { + app_regs.REG_TAG_ID_ARRIVED = 0; + app_regs.REG_TAG_ID_LEAVED = 0; + } + id_event_was_sent = true; out0_timeout_ms = app_regs.REG_TAG_ID_ARRIVED_PERIOD; notify(app_regs.REG_NOTIFICATIONS); - } + } } rxbuff_pointer = 0; From 038e2f4545ed975f68a9e2e7f4bc08b1eb84f508 Mon Sep 17 00:00:00 2001 From: Filipe Carvalho <34546039+filcarv@users.noreply.github.com> Date: Fri, 26 Jan 2024 20:41:31 +0000 Subject: [PATCH 3/3] Increased firmware version to 1.3 --- device.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.yml b/device.yml index 13a6dd0..43313e8 100644 --- a/device.yml +++ b/device.yml @@ -3,7 +3,7 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/harp-tech/reflex-generator/main/schema/device.json device: RfidReader whoAmI: 2094 -firmwareVersion: "1.2" +firmwareVersion: "1.3" hardwareTargets: "1.2" registers: InboundDetectionId: &detectionevent