You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Pierre Kircher <pk...@me.com> on 2017/05/30 08:41:36 UTC

nrf52 uicr

the nrf52 has a user config memory so called UICR starts at 0x10001080 and stores 32 bytes ..

id like to use those for internal 1 time settings like device id ..
or offsets for sensors

wiriting isnt the issue i just need to be able to access them

in the softdevice they are usualy applied like

uint32_t UICR_ADDR_0x80 __attribute__((at(0x10001080))) __attribute__((used)) = 0x12345678;

is there a current way to read them from mynewt ?

thanks a ton, and sorry if thats a noob question.

pierre

http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuicr.html&cp=2_2_0_13_0_61 <http://infocenter.nordicsemi.com/index.jsp?topic=/com.nordic.infocenter.nrf52832.ps.v1.1/uicr.html&cp=2_2_0_13_0_61>

Re: nrf52 uicr

Posted by Pierre Kircher <pk...@me.com>.
easy enough .. ya seen that the first 2 4 bytes are gone .. that still leaves me with 30x4 bytes for my uses more then enough for me

i might come up with something generic enough to build a pr around that

thanks for the insight so far!




> On 30 May 2017, at 18:50, will sanfilippo <wi...@runtime.io> wrote:
> 
> Pierre:
> 
> Accessing the UICR is pretty simple. There is a structure defined in nrf52.h that can be used to read the customer variables. You just do this: NRF_UICR->CUSTOMER[0]
> 
> Note that Aditi has pointed out that we decided to use some of the customer registers by default. You can change this if you want but that might be a bit of a pain when you upgrade. Currently, the first two locations are used in the customer space.
> 
> Note that there is no “generic” API to read them in ble_hw.c. You would just add your own code to the nrf specific code to read what you wanted from them.
> 
> 
>> On May 30, 2017, at 4:08 AM, aditi hilbert <ad...@runtime.io> wrote:
>> 
>> Hi Pierre,
>> 
>> Yes, there is a “ble_hw_get_public_addr" function that does the following:
>> 
>> * If the user has overridden the default public address (the syscfg variable) with a non-zero public address, that address will be returned by this function.
>> * If the default public address in the syscfg is all zero, the code will read FICR and check if the device address type in the FICR is public. If so, it means the nordic chip was factory programmed with a public address and this will be used.
>> * If both of the above checks fail, the code will read UICR[0] and UICR[1] to see if a public address has been programmed into the UICR. We are doing this to make it easy for folks to program their development kits with public addresses so they do not have to hardcode them. UICR[0] will contain the least significant 4 bytes of the device address. UICR[1] will contain the most significant two bytes. The upper 16 bits of this word should be set to 0. The API will presume that this is a valid public device address as long as the upper 16-bits of this 32-bit word are all zero. We will also check to see if this is a valid public address (see below). If both UICR[0] and UICR[1] are zero, this will not be considered a valid public address.
>> 
>> thanks,
>> aditi
>> 
>> 
>>> On May 30, 2017, at 4:41 PM, Pierre Kircher <pk...@me.com> wrote:
>>> 
>>> the nrf52 has a user config memory so called UICR starts at 0x10001080 and stores 32 bytes ..
>>> 
>>> id like to use those for internal 1 time settings like device id ..
>>> or offsets for sensors
>>> 
>>> wiriting isnt the issue i just need to be able to access them
>>> 
>>> in the softdevice they are usualy applied like
>>> 
>>> uint32_t UICR_ADDR_0x80 __attribute__((at(0x10001080))) __attribute__((used)) = 0x12345678;
>>> 
>>> is there a current way to read them from mynewt ?
>>> 
>>> thanks a ton, and sorry if thats a noob question.
>>> 
>>> pierre
>>> 
>>> http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuicr.html&cp=2_2_0_13_0_61 <http://infocenter.nordicsemi.com/index.jsp?topic=/com.nordic.infocenter.nrf52832.ps.v1.1/uicr.html&cp=2_2_0_13_0_61>
> 


Re: nrf52 uicr

Posted by will sanfilippo <wi...@runtime.io>.
Pierre:

Accessing the UICR is pretty simple. There is a structure defined in nrf52.h that can be used to read the customer variables. You just do this: NRF_UICR->CUSTOMER[0]

Note that Aditi has pointed out that we decided to use some of the customer registers by default. You can change this if you want but that might be a bit of a pain when you upgrade. Currently, the first two locations are used in the customer space.

Note that there is no “generic” API to read them in ble_hw.c. You would just add your own code to the nrf specific code to read what you wanted from them.


> On May 30, 2017, at 4:08 AM, aditi hilbert <ad...@runtime.io> wrote:
> 
> Hi Pierre,
> 
> Yes, there is a “ble_hw_get_public_addr" function that does the following:
> 
> * If the user has overridden the default public address (the syscfg variable) with a non-zero public address, that address will be returned by this function.
> * If the default public address in the syscfg is all zero, the code will read FICR and check if the device address type in the FICR is public. If so, it means the nordic chip was factory programmed with a public address and this will be used.
> * If both of the above checks fail, the code will read UICR[0] and UICR[1] to see if a public address has been programmed into the UICR. We are doing this to make it easy for folks to program their development kits with public addresses so they do not have to hardcode them. UICR[0] will contain the least significant 4 bytes of the device address. UICR[1] will contain the most significant two bytes. The upper 16 bits of this word should be set to 0. The API will presume that this is a valid public device address as long as the upper 16-bits of this 32-bit word are all zero. We will also check to see if this is a valid public address (see below). If both UICR[0] and UICR[1] are zero, this will not be considered a valid public address.
> 
> thanks,
> aditi
> 
> 
>> On May 30, 2017, at 4:41 PM, Pierre Kircher <pk...@me.com> wrote:
>> 
>> the nrf52 has a user config memory so called UICR starts at 0x10001080 and stores 32 bytes .. 
>> 
>> id like to use those for internal 1 time settings like device id ..
>> or offsets for sensors 
>> 
>> wiriting isnt the issue i just need to be able to access them 
>> 
>> in the softdevice they are usualy applied like
>> 
>> uint32_t UICR_ADDR_0x80 __attribute__((at(0x10001080))) __attribute__((used)) = 0x12345678;
>> 
>> is there a current way to read them from mynewt ?
>> 
>> thanks a ton, and sorry if thats a noob question.
>> 
>> pierre
>> 
>> http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuicr.html&cp=2_2_0_13_0_61 <http://infocenter.nordicsemi.com/index.jsp?topic=/com.nordic.infocenter.nrf52832.ps.v1.1/uicr.html&cp=2_2_0_13_0_61>


Re: nrf52 uicr

Posted by aditi hilbert <ad...@runtime.io>.
Hi Pierre,

Yes, there is a “ble_hw_get_public_addr" function that does the following:

* If the user has overridden the default public address (the syscfg variable) with a non-zero public address, that address will be returned by this function.
* If the default public address in the syscfg is all zero, the code will read FICR and check if the device address type in the FICR is public. If so, it means the nordic chip was factory programmed with a public address and this will be used.
* If both of the above checks fail, the code will read UICR[0] and UICR[1] to see if a public address has been programmed into the UICR. We are doing this to make it easy for folks to program their development kits with public addresses so they do not have to hardcode them. UICR[0] will contain the least significant 4 bytes of the device address. UICR[1] will contain the most significant two bytes. The upper 16 bits of this word should be set to 0. The API will presume that this is a valid public device address as long as the upper 16-bits of this 32-bit word are all zero. We will also check to see if this is a valid public address (see below). If both UICR[0] and UICR[1] are zero, this will not be considered a valid public address.

thanks,
aditi


> On May 30, 2017, at 4:41 PM, Pierre Kircher <pk...@me.com> wrote:
> 
> the nrf52 has a user config memory so called UICR starts at 0x10001080 and stores 32 bytes .. 
> 
> id like to use those for internal 1 time settings like device id ..
> or offsets for sensors 
> 
> wiriting isnt the issue i just need to be able to access them 
> 
> in the softdevice they are usualy applied like
> 
> uint32_t UICR_ADDR_0x80 __attribute__((at(0x10001080))) __attribute__((used)) = 0x12345678;
> 
> is there a current way to read them from mynewt ?
> 
> thanks a ton, and sorry if thats a noob question.
> 
> pierre
> 
> http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuicr.html&cp=2_2_0_13_0_61 <http://infocenter.nordicsemi.com/index.jsp?topic=/com.nordic.infocenter.nrf52832.ps.v1.1/uicr.html&cp=2_2_0_13_0_61>