Skip to content

High CPU usage on idle state #9

@senadir

Description

@senadir

while True:
n = self.Read_MFRC522(self.CommIrqReg)
i -= 1
if ~((i != 0) and ~(n & 0x01) and ~(n & waitIRq)):
break

so CPU usage is really high, about 105% on idle state, the raspberry shutdown after a while and we have to restart the code again.

I tracked the problem the line 216 in MFRC522, I've added a simple sleep of 10 milliseconds and it seemed to lower the CPU usage a bit (about 45%); it still cause an issue and the reader stops randomly.

for the record, I didn't hook up the IRQ pin (i was following a tutorial that referred this code and they didn't hook it up), could this be the case? I could test since I've run out of pins in my IoT device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions