prusa3d / Prusa-Firmware-MMU

Other
32 stars 15 forks source link

VCC runtime undervoltage detection (module + logic) #265

Closed leptun closed 1 year ago

leptun commented 1 year ago

Prototype of the VCC undervoltage detection. I set the threshold to 4.1V, but this value can still be tuned. According to the datasheet, the bandgap voltage that we are measuring is not that precise, so we might need to leave some margin such that false detections don't happen on some MMU units. I simulated the undervoltage by shorting the 5V rail to GND via a 33ohm resistor on the P6 unpopulated header. That resistor is enough to lower the 5V rail from ~4.2V to 3.9V, which triggers the panic error. Another thing that could still be tuned are the number of dummy reads that we need to perform. Without the dummy reads, the previous measurement affects the bandgap measurement. I set it to 10 dummy reads, but we can try reducing this value and see if it still works reliably. I also found a bug in the ADC code and fixed it.

MMU-220