Skip to content

Commit d6c106f

Browse files
authored
Merge pull request RfidResearchGroup#221 from Dmytro02/fix-LF-emulation
fix-LF-emulation
2 parents 8a797b8 + c7d6224 commit d6c106f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: firmware/application/src/rfid/nfctag/lf/lf_tag_em.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ uint64_t em410x_id_to_memory64(uint8_t id[5]) {
201201
*/
202202
bool lf_is_field_exists(void) {
203203
nrf_drv_lpcomp_enable();
204-
bsp_delay_us(20); // Display for a period of time and sampling to avoid misjudgment
204+
bsp_delay_us(30); // Display for a period of time and sampling to avoid misjudgment
205205
nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_SAMPLE); //Trigger a sampling
206206
return nrf_lpcomp_result_get() == 1; //Determine the sampling results of the LF field status
207207
}
@@ -261,7 +261,10 @@ void timer_ce_handler(nrf_timer_event_t event_type, void *p_context) {
261261
if (m_is_send_first_edge == true) { // The first edge of the next sends next time
262262
if (++m_bit_send_position >= LF_125KHZ_EM410X_BIT_SIZE) {
263263
m_bit_send_position = 0; // The broadcast is successful once, and the BIT position is zero
264-
if (++m_send_id_count >= LF_125KHZ_BROADCAST_MAX) {
264+
if(!lf_is_field_exists()){ // To avoid stopping sending when the reader field is present
265+
m_send_id_count++;
266+
}
267+
if (m_send_id_count >= LF_125KHZ_BROADCAST_MAX) {
265268
m_send_id_count = 0; //The number of broadcasts reaches the upper limit, re -identifies the status of the field and re -statistically count the number of broadcast times
266269
}
267270
}

Diff for: firmware/application/src/rfid/nfctag/lf/lf_tag_em.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* The definition of the packaging tool macro only needs to be modulated 0 and 1
1212
*/
1313
#define LF_125KHZ_EM410X_BIT_SIZE 64
14-
#define LF_125KHZ_BROADCAST_MAX 3 // 32.768ms once, about 31 times in one second
14+
#define LF_125KHZ_BROADCAST_MAX 10 // 32.768ms once, about 31 times in one second
1515
#define LF_125KHZ_EM410X_BIT_CLOCK 256
1616
#define LF_EM410X_TAG_ID_SIZE 5
1717

0 commit comments

Comments
 (0)