I pretty quickly skimmed the last 3 posts, hopefully I didn’t miss anything critical:
- OTC is charged to Vcc as Mike C mentioned.
- Changing vRef takes time and seems to cause incorrect readings - I believe you may have to take and discard a minimum of one reading, maybe 2, in order to get the vRef change working correctly. And that has to happen every time you make the change. I am not super knowledgeable on this subject. The most simple thing is to permanently change vRef and use a different (appropriate) voltage divider ratio to monitor battery voltage. (eg change R1 or R2 to a different value)
- The latest PNP transistor modes-issue is possibly caused by that particular transistor’s performance characteristics together with the high freq PWM. IIRC Phase Correct PWM should be 1/2 the freq though, so I’d expect at least a small difference. For testing please drop PWM freq drastically using the divider or prescaler. See HarleyQuin’s post over here, #174 - STAR Firmware by JonnyC - Source Code and Explanation - try for ~1khz or ~200hz or something.
- I don’t know the cause of the memory issue w/ the PNP transistor.
- Purpose-built current shunts can be purchased cheaply on eBay etc.