LPC11u68 SYSCON PRESETCTRL not setting

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC11u68 SYSCON PRESETCTRL not setting

ソリューションへジャンプ
884件の閲覧回数
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 解決策
673件の閲覧回数
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 返答(返信)
673件の閲覧回数
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!
-----------------------------------------------------------------------------------------------------------------------

674件の閲覧回数
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 件の賞賛
673件の閲覧回数
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 件の賞賛