You should be able to do exactly what you tried to do; that was one of the 
intents with os_cputime. Hopefully I will have an answer soon regarding why 
this does not work.

Regarding timers:

The nimble stack on the nrf52 currently uses Timer 0 for cputime (and thus for 
the controller BLE timing). It either uses RTC1 or TIMER1 for the os tick, 
depending on the syscfg variable XTAL_32768 in your bsp syscfg.yml file.


> On Jan 8, 2017, at 6:20 PM, WangJiacheng <[email protected]> wrote:
> 
> Hi, Will,
> 
> Thanks a lot for your reply.
> 
> Yes,the hardwear processor clock frequency of nRF52 (Cortex M4F) is 64 MHz 
> and can not be changed.
> 
> The reason of changing CLOCK_FREQ is that I want re-use the internal timing 
> of mynewt already there with more accurate timing, by calling function 
> "os_cputime_get32()”.  I’m trying to implement a (soft) IC card reader by 
> nRF52 with mynewt OS and nimble stack running.
> 
> I am also considering to use an independent timer (NRF_TIMER3 or  NRF_TIMER4) 
> at the cost of about 0.1mA current. I already use NRF_TIMER2 to provide a 4 
> MHz clock signal output from GPIO of nRF52. By reading the source code of 
> apache-mynewt-core, my understanding is that NRF_TIMER0 and NRF_TIMER1 is 
> already used by mynewt OS and nimble stack, is my understanding correct?
> 
> Thanks,
> 
> Jiacheng
> 
>> 在 2017年1月9日,01:10,will sanfilippo <[email protected]> 写道:
>> 
>> Those should be the only two parameters you need to configure. Must be a bug 
>> in the controller :-)
>> 
>> I think it is worthwhile to point out that CLOCK_FREQ only changes the units 
>> of os cputime; it does not affect the speed at which the processor runs. At 
>> least, I could not see any other uses of CLOCK_FREQ. So, these settings only 
>> affect the nimble stack and the controller specifically (internal controller 
>> timing).
>> 
>> I am curious why you wanted to change this variable; what were you trying to 
>> achieve?
>> 
>> Thanks for pointing this out; I will take a look to see why it is not 
>> working.
>> 
>>> On Jan 7, 2017, at 10:48 PM, WangJiacheng <[email protected]> wrote:
>>> 
>>> Hi, 
>>> 
>>> The default CPU time frequency of Mynewt OS and Nimble stack is 1 MHz, I 
>>> try to change the CPU time frequency to be 2 MHz, I modified the related 2 
>>> config files:
>>> configure file “hw/bsp/nrf52dk/syscfg.yml” as
>>>  CLOCK_FREQ:
>>>      description: 'TBD'
>>>      value:  2000000 
>>> configure file “kernel/os/syscfg.yml” as
>>>  OS_CPUTIME_FREQ:
>>>      description: 'Frequency of os cputime'
>>>      value: 2000000
>>> 
>>> The app “bleperiph" is running and the CPU time frequency is 2 MHz, also 
>>> the BLE “nimble-bleprph” peripheral  can be scanned by LightBlue of iOS 
>>> APP, and show 1 service is there. However, when I try to connect it ,an 
>>> error massage “Connection Alert: Timeout interrogating the peripheral”
>>> 
>>> When change back above 2 syscfg parameters to 1000000, it can be connected.
>>> 
>>> And app “bletiny” is the same.
>>> 
>>> Is there any  missed config setting in my test? How to change the CPU time 
>>> frequency to 2 Mhz and Nimble device can be connected?
>>> 
>>> Thanks,
>>> 
>>> Jiacheng 
>>> 
>>> 
>> 
> 

Reply via email to