I have a peculiar issue with writing a driver for LPC11U68. I want to use SCT0 and for that I need to set or rather unset the reset bit for SCT0.
#define _BV(pin) (1U << (pin))uint32_t before = LPC_SYSCON->PRESETCTRL; if (a_chn < 10) LPC_SYSCON->PRESETCTRL != _BV(9); //SCT0 reset disable else LPC_SYSCON->PRESETCTRL != _BV(10); //SCT1 reset disable LPC_SYSCON->SYSAHBCLKCTRL |= _BV(31); //enable SCT0_1 uint32_t after = LPC_SYSCON->PRESETCTRL;
Funny enough before == after == 0x00. For some reason PRESETCTRL doesnt accept any input. While, SYSAHBCLKCTRL sets the bit without any problems. Is there something I need to enable prior to changing the PRESETCTRL ?
Thanks
Solved! Go to Solution.
I see what you mean. It was a stupid typo
!= (not equal) instead of
|= (or and assign).
thanks for pointing that out. I was just blinded by similarity.
Hi Sven,
I think your problem is caused by your code:
LPC_SYSCON->PRESETCTRL != _BV(10); //SCT1 reset disable LPC_SYSCON->PRESETCTRL != _BV(9); //SCT0 reset disable Please rewrite it like this:LPC_SYSCON->PRESETCTRL &= ~(_BV(10)); //SCT1 reset disableLPC_SYSCON->PRESETCTRL &= ~(_BV(9)); //SCT0 reset disable It's totally your code written problem.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I see what you mean. It was a stupid typo
!= (not equal) instead of
|= (or and assign).
thanks for pointing that out. I was just blinded by similarity.
Hi Sven,
You are welcome!
If you still have question about this topic, just let me know.
If your question is solved, please help me to mark the correct answer, just to close this case, thank you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------