LPC11u68 SYSCON PRESETCTRL not setting

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC11u68 SYSCON PRESETCTRL not setting

Jump to solution
260 Views
Contributor III

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

Labels (2)
1 Solution
49 Views
Contributor III

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.

View solution in original post

0 Kudos
3 Replies
49 Views
NXP TechSupport
NXP TechSupport

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 disable
LPC_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!
-----------------------------------------------------------------------------------------------------------------------

50 Views
Contributor III

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.

View solution in original post

0 Kudos
49 Views
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos