reserved register bits clarification

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

reserved register bits clarification

248 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jmhartmann on Fri Aug 14 14:01:03 MST 2015
In the User Manual UM10470, many configuration registers described have bits described as "Reserved. Read value is undefined, only zero should be written". This implies that read/modify/write operations such as "example->register |= 0x01" would not be allowed because the entire register is read, bit zero is set, and the entire register is written back.

However, in driver code provided by NXP such as the drivers here: https://www.lpcware.com/content/nxpfile/lpc177x-and-lpc178x-cmsis-compliant-standard-peripheral-firm..., this is precisely what the driver is doing. For example, in the file lpc177x_8x_timer.c where the register TCR is modified. TCR bits 31:2 are defined as "Reserved. Read value is undefined, only zero should be written".  See the code below for the implementation.

My question is, is the UM correct and the example code wrong?

Thanks.


/*********************************************************************//**
* @brief       Start/Stop Timer/Counter device
* @param[in]   TIMx Pointer to timer device, should be:
*              - LPC_TIM0: TIMER0 peripheral
*              - LPC_TIM1: TIMER1 peripheral
*              - LPC_TIM2: TIMER2 peripheral
*              - LPC_TIM3: TIMER3 peripheral
* @param[in]   NewState
*              -   ENABLE  : set timer enable
*              -   DISABLE : disable timer
* @return      None
**********************************************************************/
void TIM_Cmd(LPC_TIM_TypeDef *TIMx, FunctionalState NewState)
{
    if (NewState == ENABLE)
    {
        TIMx->TCR   |=  TIM_ENABLE;
    }
    else
    {
        TIMx->TCR &= ~TIM_ENABLE;
    }
}

Labels (1)
0 Kudos
0 Replies