What does USB_CLK_RECOVER_IRC_EN_REG_EN_MASK do?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What does USB_CLK_RECOVER_IRC_EN_REG_EN_MASK do?

754 Views
bobpaddock
Senior Contributor III

The MKL27 datasheet for USBx_CLK_RECOVER_IRC_EN fields says bit zero is reserved, yet the example code for the MKL43 (parent of 27) is setting it in the example code.

What does it do?

When I see 'reserved' in a datasheet to me it means I should not mess with it. If I'm required to mess with then I want to know why.

Labels (1)
Tags (3)
3 Replies

555 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Bob Paddock:

Could you point me to the example code you are referring to?

I will investigate if that bit is relevant somehow for the working of the Internal Reference Clock. Let me come back to you with the experts' feedback.

Regards!

Jorge Gonzalez

0 Kudos
Reply

555 Views
bobpaddock
Senior Contributor III

It is in the Mouse demo of FRDM-KL43-SC-BAREMETAL.exe

The data sheet needs to be updated to either explain what this bit does, or at least mention that it need to be set to '1'.

The default reset values show it defaults to '1' but the text says nothing about it so it is easy to overlook keeping this bit set when setting other bits in the register.

*****************************************************************************

* This function starts the Mouse Application

*****************************************************************************/

void USB_Mouse_Init(void)

{

  uint_8   error;

  rpt_buf[3] = 0x00;          /* always zero */

  *((uint_32_ptr)rpt_buf) = 0;

  *((uint_32_ptr)null_buf) = 0;

  

  __disable_irq();            /* Global Intterupt disable    */ 

 

  /* old documentation writes setting this bit is mandatory */

  USB0_USBTRC0 = 0x40;

 

  NVIC_ICPR = (1 << 24);      /* Clear any pending interrupts on USB */

  NVIC_ISER = (1 << 24);      /* Enable interrupts from USB module   */

  USB0_CLK_RECOVER_IRC_EN = USB_CLK_RECOVER_IRC_EN_IRC_EN_MASK|USB_CLK_RECOVER_IRC_EN_REG_EN_MASK;

  USB0_CLK_RECOVER_CTRL = USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK|USB_CLK_RECOVER_CTRL_RESTART_IFRTRIM_EN_MASK;

 

  /* Initialize the USB interface */

  error = USB_Class_HID_Init(CONTROLLER_ID,

                             USB_Mouse_Callback,

                             NULL,

                             USB_Mouse_Param_Callback);

 

  UNUSED(error);

 

  __enable_irq();             /* Global Intterupt enable */ 

}

0 Kudos
Reply

555 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Bob:

I got information about this. The bit is indeed reserved and defaults to 1, it is not required to set it, any writes to the bit are ignored. Actually the bit mask has been removed from the CMSIS header file for MKL43Z.

The code example is most probably based on the example for other device such as K64, which requires that bit as 1 to have a local regulator for the IRC48M enabled.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------