Wireless timer synchronization nRF5340 (build error).

Hello

I want to make an application that will be sending data from 3 peripheral BLE devices to the central device which wil be connected to PC and transmitting data (from all 3 peripheral devices) to it.
Sensor data will be received and sent 100 times per second from each device to the central device. Data from sensors must be collected and sent at the same time to prevent the receiver (central device) to receiving data from different moments in time. The measurement should last even 3 hours and clocks of peripheral devices cannot differ so much that the data received by the central device will be shifted relative to each other in time by more than 1 ms during the entire measurement.

I saw this time synchronization project:
Wireless timer synchronization among nRF5 devices
https://github.com/nordic-auko/nRF5-ble-timesync-demo

but I have problem with building it on nRF5340.
I am using NRF Connect SDK 2.5.0 and toolchain 2.5.0


This my build configuration:


this is what I have on my terminal:


I don't know why this error occurred. I just try to build code from github without any modyfication.
Can you help me resolve this problem?

I also have a question whether this is the only example of wireless clock synchronization or are there others (which might be better suited for my application) ?


Best Regards

Parents
  • Hi,

    I have replicated the error using nrf5340-dk. Is there any specific reason why you would want to use this sample on nrf5340-dk?

    The sample should build fine on nrf52840-dk. Have you tried it?

    Best regards,
    Dejan

  • HI,

    I want to make my project on nRF5340, so I want to build this sample on it and I thought that this sample is compatible with nRF5340dk because there are 5340 board configurations



    I also tried to build this sample for nRF52840 but I had an error.

    build configuration;


    error:




    Best Regards

  • Hi,

    Thanks a lot, now it is working on nRF5340 network core.

    Regarding to nRF52840 I found out why building was unsuccessful. I don't know why, but in my SDK v2.5.0 there was no tinycrypt library, so I copied it from another SDK folder (I had this library in SDK 2.4.3 and 2.6.1 folders, but not in 2.5.0 folder) and now it is building.

    I also have 2 more questions.
    1. Why this sample isn't building when I choose nRF5340 cpuapp ?
    2. How to convert this sample for SDK v2.6.1 or v2.7.0 ?

    Best Regards

  • Hi,

    ..... said:
    1. Why this sample isn't building when I choose nRF5340 cpuapp ?

    This sample has the requirement to be built for the network core.

    ..... said:
    2. How to convert this sample for SDK v2.6.1 or v2.7.0 ?

    The timesync sample has been made as out-of-tree application with its own west manifest. You could try to update west.yml file for the application with appropriate NCS version you want to use. You can look at nrf west.yml for needed versions. Then you should use "west init -l timesync_sample" and "west update". Check that ZEPHYR_BASE points to your local Zephyr directory. There is an old guide which provides relevant information. Afterwards, try to build and flash the sample and look for possible clues in the error log (if you get an error). 

    Best regards,
    Dejan

  • I'm trying to do the same thing, get the above Github repo: github.com/.../nRF5-ble-timesync-demo to work on the nrf5340-dk. I have updated the overlay files and copied over the necessary libraries but cannot get the sample functional on the nrf5340-dk. I receive the following compile time overflow error of ~25k when building for the nrf5340-dk's network core:

    ---



    ---

    I have gotten around this by modifying the file: "ncs/zephyr/dts/arm/nordic/nrf5340_cpunet_qkaa.dtsi" to have a flash1 reg of 512k instead of 256k. This works to get around the compile time over flow error but when I attempt to flash the build I get a new error:

    ^ showing the build succeeding 


    ^ showing "flash-time" error

    This "flash-time" error leads me to believe I'm incorrectly increasing the 5340's network core flash size.

    ---

    I have also tried to use the "CONFIG_SIZE_OPTIMIZATION=y" config option, which does reduce the image size but still not enough to flash to the default partition size. I do however get a small enough size by turning off logging but the sample does not work as expected and I think its due to the warnings from the above build output regarding the Timers and their configs.

    I really appreciate this forum post and I look forward to a response indicating how I can get this sample functional on my nRF5340-dk. I think the most appropriate way to do this is by increasing the network core flash partition size to allow for logging at the same time as the sample is running to help debug the sample on my 5340.

    While I wait for a reply I will try toggling the synch pin manually and add gpio-callbacks to the forwarded buttons to ensure they're functioning as expected. This will show for sure that the problem lies with the Timers as the cmake warnings indicate. Again, Thank you for your time and help.

    Please show me that you achieve the correct functionality when using an nRF5340-dk by showing a screenshot of your osciliscope and the skew between two or more devices with the sample running. It is not clear from this forum post that  was able to achieve the correct functionality on the 5340-dk network core.


    ---

    Here are images of the sample working great on my nrf5240s with logging enabled:





    Respectfully,
    Brady

  • Hi Brady,

    blue_dew said:
    This "flash-time" error leads me to believe I'm incorrectly increasing the 5340's network core flash size.

    You can find in the nRF5340 product specification that the flash size for network core is fixed in hardware to 256 KB.

    EDIT: Have you tried to resolve dependencies for config options shown in the first screenshot in your previous reply?

    Best regards,
    Dejan

  • Hi dejans,

    Thank you for the reply! I have tried resolving the dependencies by modifying the prj.conf file as follows:
    8030.prj.conf

    Here is a quick screenshot of the above conf file:

    Notable changes include the previously mentioned size optimization and removal of the shell config. I have also enabled DPPI instead of PPI. Finally, the changes to the timer configs because from the nrf5340 spec sheet I see the following:

    This leads me to believe that "TIMER 3" and "TIMER 4" are not available to the network core, so of course, I would get the earlier warnings. This builds as expected but does not run. 
    ---
    Thankfully I figured out what I was missing!!! I reviewed my build config and saw that I forgot to add the config fragment for the cputnet.conf file from the 'boards/' directory. I don't understand why the confs for the nrf5340dk_nrf5340_cpunet.conf are what they are, but not having them caused a SIGTRAP to be thrown within my net core application. I'm now getting terminal output after adding that conf as a "config fragment" and the following outputs on my oscilloscope when running three nrf5340dks together:


    ^ terminal output of all three nrf5340dks

    ^ updated build config w/ the config fragment "boards/nrf5340dk_nrf5340_cpunet.conf" added

    ^ oscilloscope output from the 3 dev kits gpio pin
    and finally, my favorite image...

    all three nrf5340dks lined up and working great as expected!!! 

    ---

    Thank you again for the reply  and the forum post  

    Best,
    Brady Adcock


Reply
  • Hi dejans,

    Thank you for the reply! I have tried resolving the dependencies by modifying the prj.conf file as follows:
    8030.prj.conf

    Here is a quick screenshot of the above conf file:

    Notable changes include the previously mentioned size optimization and removal of the shell config. I have also enabled DPPI instead of PPI. Finally, the changes to the timer configs because from the nrf5340 spec sheet I see the following:

    This leads me to believe that "TIMER 3" and "TIMER 4" are not available to the network core, so of course, I would get the earlier warnings. This builds as expected but does not run. 
    ---
    Thankfully I figured out what I was missing!!! I reviewed my build config and saw that I forgot to add the config fragment for the cputnet.conf file from the 'boards/' directory. I don't understand why the confs for the nrf5340dk_nrf5340_cpunet.conf are what they are, but not having them caused a SIGTRAP to be thrown within my net core application. I'm now getting terminal output after adding that conf as a "config fragment" and the following outputs on my oscilloscope when running three nrf5340dks together:


    ^ terminal output of all three nrf5340dks

    ^ updated build config w/ the config fragment "boards/nrf5340dk_nrf5340_cpunet.conf" added

    ^ oscilloscope output from the 3 dev kits gpio pin
    and finally, my favorite image...

    all three nrf5340dks lined up and working great as expected!!! 

    ---

    Thank you again for the reply  and the forum post  

    Best,
    Brady Adcock


Children
Related