Dear Dialog,
After tuning the crystal on my latest batches of boards, I found that I was receiving ASSERT_WARNING in lld_sleep_compensate_func()
// If this Assertion hits then the LP ISR lasts longer than the time
// that has been reserved via LP_ISR_TIME_XTAL32_CYCLES and LP_ISR_TIME_USEC.
if (sleep_lp_cycles && (sleep_lp_cycles < slp_period))
ASSERT_WARNING(0);
My crystal trim is set to 0xFF, the maximum value / lowest frequency. The warning vanishes when I return the value to the default 0x80, but my BLE frequency error is greater at that point. My tuning process was to check the BLE frequency offset error with a spectrum analyzer and tune the crystal accordingly to minimize error.
Do you have any advice here? Is this a hardware design issue, should I investigate purchasing crystals with additional load capacitance, etc. ? I am using a 32MHz, 6pF crystal with +/-10ppm tolerance and aging (part no. XRCGB32M000F1H00R0).
Thanks,
Mike
Hi mbwjr12,
Thanks for your question online and for your interest in our BLE solutions.
I would recommend first checking theAN-B-075: DA14531 Hardware Guidelinesapplication note that provides the minimal reference schematic, circuit explanation, and design guidelines for BLE applications based on the DA14531 SoC.
Regarding the crystal oscillator specifications, please refer to section 3.2.2 and table Table 10.
Crystal trimming guidelines are described on section 3.2.2.1.
Thanks, PM_Dialog
Hello Dialog,
Yes, I referred to the crystal specs and hardware design guidelines in my design. I used the exact same crystal as the devkit. I have followed the layout guidelines and removed the planes underneath the crystal pads. In general, my design is as expected.
I have a few questions:
Thanks,
Mike
Hi mbwjr12,
Apologies for the delay. Let me check it and I’ll get back to you.
Thanks, PM_Dialog
Hi mbwjr12,
Regarding the specific warning, this means that the system spends too much time sleeping and is not able to wake up on time, so the SDK is warning you about this. Probably it might not be related to the crystal trimming, so I would like to check out.
This assertion can also occur if the DA14531 is active (no BLE core active) with the interrupts disabled and its time for BLE core to wake up. To do so, at some point when it’s time for the LP_Handler to execute since the interrupts are disabled the ISR delays execution (at some point the interrupts are enabled but the Handler isn't executed on time). With other words that means that the device was sleeping longer than the time defined and the ASSERTION will occur.
I am putting below some question in order to understand better the problem :
Thanks, PM_Dialog
Hello,
1. I am using RCX, no external LP crystal is used.
2. I have not. I have made two modifications to the SDK:
1. to retrieve the BLE address easily I extern'd struct bd_addr app_random_addr
2. I modified arch_system to retrieve the default crystal trim value from a config flag instead of the OTP if it isn't present, like this:
CFG_DEFAULT_XTAL32M_TRIM_VALUE is 0x80 for the QFN chip by default, which does not cause the warning, but at 0xFF it does.
3. I do not believe I ever disable interrupts. I have reviewed my code and have found no direct, or indirect through dialog API calls, way in which I disable them.
4. I have checked periph_init. The only calls it makes are to GPIO_ConfigurePin (lights_init() also just calls GPIO_ConfigurePin())
5. I am using custom code. The firmware is in a late beta or release candidate stage, it was only with the most recent batch of boards that this warning was experienced with the crystal tuning. I have not tried running sample code, if I have time I will investigate this.
If I cannot easily resolve this issue, it seems as long as my final tuning value keeps the initial frequency offset error within about 75KHz and without trimming the crystal too far to cause this warning, I should be fine in production. Max BLE error as per spec is 150KHz, and this should give me plenty of margin with a +/-10ppm initial, +/-10ppm temperature, and some aging tolerance on the crystal. If that's roughly 30ppm total worst case it's ~75KHz additional error possible at the expected lifespan of the product.
Thanks,
Mike
Hi Mike,
Please see section 24.1.4 from the user guide – link is provided below :
http://lpccs-docs.dialog-semiconductor.com/UM-B-083/tools/RfMaster.html
Then please use the Spectrum Analyzer so that you can decide which is the best trimming value.
After that, you can change the default value in the arch_system.c file. Please check DEFAULT_XTAL32M_TRIM_VALUE_QFN and DEFAULT_XTAL32M_TRIM_VALUE_WLCSP macro which hold the default trimming values.
In the meanwhile I’ll check it again – as mentioned in my previous comment, the probable reason for this warning is because the system spends too much time sleeping and is not able to wake up on time.
Thanks, PM_Dialog
I'm posting an update for other people experiencing the same problem. I diagnosed it to a bad crystal: the latest production test batch was actually not using XRCGB32M000F1H00R0 like the earlier batches, and some alternative crystal was substituted with unknown characteristics.
Using a calibrated frequency counter, I was able to show that it was off by 52ppm at 25C, and likely worse at other temperatures. This exactly matched the error I was seeing with my spectrum analyzer (2.402GHz * 52ppm ~=125KHz error). It may also have had the wrong capacitance, etc. My issues were resolved when I soldered the correct part in its place.
So far, I have not been able to reproduce this issue with the correct crystal at the default trim of 0x80. I will update this thread if that changes, but otherwise I consider this issue closed.
Hi mbwjr12,
Thank you very much for your comment and for the indication. It will be very helpful for the community.
Thanks, PM_Dialog