I am having trouble setting the PWMZEROCMP bit (bit 9 of pwmcfg) on the hifive unmatched board on both PWMs. I have a simple userspace program that does the following:
pwmcfg = 0xf // I am only setting scale
while pwmzerocmp is not set:
pwmcfg |= pwmzerocmp bit
wait a few cycles
if this is iteration is a multiple of 50, print out pwmcfg to see if pwmzerocmp has been set
Pwmcfg stays at 0xf the first couple thousand times the loop is run (it is an infinite loop). This is not what I would expect: the u74 manual says that this bit is writable. So I would have expected it to be set the first iteration of the loop, and then a break to occur.
However, I just let the loop spin. Eventually, pwmcfg becomes 0x40f and stays there for a few thousand iterations. I never set the deglitch bit.
If I continue to run this loop, all four IP bits get set after a few thousand more iterations. PWMENALWAYS and PWMENONESHOT are both unset, so I am not sure how IP is triggered.
Any advice/thoughts on what I’m missing would be appreciated!
–Justin