This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Build error for example code of MAX30101 with nRF SDK v1.5.0

Hello,

I am using example code of MAX30101 Pulse Oximeter sensor with nRF SDK v1.5.0 on board NRF5240DK. I copied the example from the ncs \ v1.5.0 \ zephyr \ samples \ sensor \ max30101 folder to the ncs \ v1.5.0 \ nrf \ samples \ sensor \ max3010 folder. I also created a file nrf5340dk_nrf5340_cpuapp.overlay in the \board folder and added there:

Building the example code I am getting macro error in devicetree.h file as mentioned below

#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))

with following message in output

error: 'DT_N_INST_0_max_max30101_P_label' undeclared (first use in this function)

Please suggest appropriate solution for the above problem.

Thanks.

Parents
  • Hi,

    Try replacing the contents of your overlay file with:

    The extra spaces seem to be the source of your problems.

  • Hello! I did not carefully place the code here, my fault sorry, in the file nrf5340dk_nrf5340_cpuapp.overlay it is written without spaces.

  • Make sure that there isn't a space between 'max,' and 'max30101' on the line:

    Since the sample uses logging, and uart0 is the default for the uart console, it would be simplest to use i2c1, like in my previous reply.
    My overlay file is only the 7 lines I gave in my previous response and it builds.

  • I have checked the spaces' max, 'and' max30101 are not present. Used i2c1 left only seven lines, but unfortunately it did not help, the same error gets out.

Reply
  • I have checked the spaces' max, 'and' max30101 are not present. Used i2c1 left only seven lines, but unfortunately it did not help, the same error gets out.

Children
  • Ok, could you zip the entire project folder, with the build folder, and send it to me using: Insert->Image/video/file

    I can compare it to the one I am using, and the generated files in the build folder should give me an idea what's going on.

  • Ok here is the zip file with example and build folder.max30101.zip

  • Looks like you are using i2c1 for an arduino? You also have 2 overlay files, which isn't necessary.

    This overlay file tries to use i2c2 instead: 7853.nrf5340dk_nrf5340_cpuapp.overlay

    If you still get errors, the full transcript from the output window would be helpful.

  • I managed to solve this problem. I ran the "west update" command and in "Segger Studio" in the "Project" menu I ran "Run Cmake" and everything compiled. Thanks Øivind for trying to help.