LPC11u68 SYSCON PRESETCTRL not setting

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC11u68 SYSCON PRESETCTRL not setting

跳至解决方案
905 次查看
svensavic
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

标签 (2)
1 解答
694 次查看
svensavic
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.

在原帖中查看解决方案

0 项奖励
3 回复数
694 次查看
kerryzhou
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!
-----------------------------------------------------------------------------------------------------------------------

695 次查看
svensavic
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.

0 项奖励
694 次查看
kerryzhou
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 项奖励