Trying to build nrf52-ble-image-transfer-demo project in Keil but getting build errors

Hello,

I am trying to the build the following demo from github on Keil:

https://github.com/NordicPlayground/nrf52-ble-image-transfer-demo

I am using Keil uVision V5 MDK-Lite with default compiler V6 along with nRF5SDK160098a08e2 and s132nrf52701 softdevice

I managed to get the softdevice, Nordic Packages, etc. setup properly (I think!)

I flashed (loaded) the s132_nrf52_7.0.1_softdevice.hex to the nRF52 DK nRF52832 eval boards

I get the following build errors:

Build started: Project: image_transfer_demo_pca10040_s132
*** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
*** Warning: You are compiling one or more files of source type C++ and have selected 'use MicroLIB'. MicroLIB does not support C++!

Build target 'nrf52832_xxaa'
ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp.c'
ArmClang: error: no input files
compiling bsp.c...
ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp_btn_ble.c'
ArmClang: error: no input files
compiling bsp_btn_ble.c...
RTE/Device/nRF52832_xxAA/system_nrf52.c(30): error: 'nrf52_erratas.h' file not found
#include "nrf52_erratas.h"
^~~~~~~~~~~~~~~~~
1 error generated.
compiling system_nrf52.c...
C:/Nordic/sdk/nRF5SDK160098a08e2/components/libraries/util/app_error_handler_keil.c(45): error: expected '(' after 'asm'
__ASM void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
^
C:/Nordic/sdk/nRF5SDK160098a08e2/components/libraries/util/app_error_handler_keil.c(45): error: expected ';' after top-level asm block
__ASM void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
^
;
C:/Nordic/sdk/nRF5SDK160098a08e2/components/libraries/util/app_error_handler_keil.c(47): error: use of undeclared identifier 'PRESERVE8'
PRESERVE8 {TRUE}
^
3 errors generated.
compiling app_error_handler_keil.c...
".\_build\nrf52832_xxaa.axf" - 8 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01

For the 

ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp.c'
ArmClang: error: no input files
compiling bsp.c...
ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp_btn_ble.c'
ArmClang: error: no input files

errors: I did make sure the both C/C++ and ASM Include Paths point to the SDK I downloaded but I still get these errors.

Please advise. 

Thanks,

Adnan

Parents
  • Hi Adnan

    What issue do you get when you run the module at 3V? 

    While it is true that this is outside the official voltage range this is more likely to work than to run the supply at 5V while you run all the SPI and I2C lines at 3V. Then you can quickly get issues with the communication, since the high level of the signals coming from the nRF is too low for the Arducam. 

    Does the read_reg still return random values when running at 3V, or is it consistent?

    Also, I forgot that you were using the OV5642 5MP mini plus and not the OV2640 that I was using for the demo. I have never tested the code with this module, and there might be some differences in the configuration that you have to account for. Still, if you get random values from the test register then it points to a more critical communication issue. 

    adnankhalid said:

    I was using the Zephyr code base on this same board before, can that have something to do with this?

    Does the Build and Run option on Segger completely remove the Zephyr code base?

    I sincerely doubt this is the issue. SES will reprogram all the necessary memory regions for the SoftDevice and application. 

    You could always try to do an erase all first (either through SES or by running nrfjprog -e from the command line), but it shouldn't make a difference. 

    Best regards
    Torbjørn

  • Hello Torbjorn,

    The issue is the same:

    The read_reg returns random values (between 0x00 - 0x67) and sometimes 0x55 and if it does, the software hangs on twim_busy in the function:

    //I2C Write 16bit address, 8bit data
    uint8_t arducam_wrSensorReg16_8(int regID, int regDat)
    {
    uint8_t txBuf[3] = {regID >> 8, regID & 0x00FF, regDat & 0x00FF};
    arducam_twi_tx_rx(txBuf, 3, 0, 0);
    while(twim_busy);
    nrf_delay_ms(1);
    return (1);
    }

    I have updated the code to reflect the changes required for the OV5642 module and it should be OK. 

    I tend to agree with you that this is a critical communication issue. Once I have camera_init() commented out, the code just runs and I am able to advertise the board and see it on an android device.

    This issue is the SPIM/TWIM and that's where I need help debugging this application.

    Please see the attached project and advise.

    Thanks,

    Adnan

  • Hi Adnan

    It is limited what use I have of the project without the camera module available. 

    I would have to recommend that you get the OV2640 module instead, since this is the one the project was designed for. 

    Alternatively you can ship me one of the OV5642 modules and I can try to test it out. 

    Best regards
    Torbjørn

Reply Children
  • Hello Torbjorn,

    So I have ordered the OV2640 and will set that up once I receive it.

    In the meantime, some good news! I managed to get part of the project working, I think:

    The hardware RESET does seem to work. I didn't realize that it can take up to 30secs for the reset to complete. Is this time frame normal?

    The camera does initialize and the OV5642 is detected. The android app is able to connect via BLE and the handshaking is successful.

    The issue is that any BLE CMD sent from the Android app is not getting to the nRF52 DK for some reason and the microcontroller hangs up. There are no error codes or warnings.

    Any idea what can be causing this? Please advise.

    Thanks,

    Adnan

  • Hi Adnan

    It is very good to hear that you had some progress getting the OV5642 to work Slight smile

    It sounds a bit odd that it would take the device 30 seconds to start. This is a lifetime in embedded terms, where most operations finish in milliseconds or microseconds. 
    Which supply voltage are you running at? 
    If you are running it at 3V, maybe it is a consequence of using a supply below the specification.

    One thing you can try is to close the SB10 solder bridge on your DK, by applying solder to it. This will bypass a protection diode on the USB power and bring the voltage up to 3.3V (just make sure not to connect more than one power source to the kit at a time). 

    adnankhalid said:

    The issue is that any BLE CMD sent from the Android app is not getting to the nRF52 DK for some reason and the microcontroller hangs up. There are no error codes or warnings.

    Any idea what can be causing this? Please advise.

    Hard to say what this might be without more information. 

    Did you try to run the debugger on the nRF device in order to see what is going on?

    Could you do this, and try to add a breakpoint inside the its_data_handler(..) function on line 211 of main.c? 
    Whenever you send any data from the app to the kit this handler function should be called. 

    A second thing to try is to use the nRF Connect for Mobile application on the phone side rather than the dedicated image transfer application. Then you will get a lot more logging information on the phone side, and you can check that the basic Bluetooth interaction is working well. 

    Try to connect to the device, verify that service discovery completes and the custom service shows up, and try to send some data on the RX characteristic (this would be the one that supports write in the app, not notify like the other two). 

    Best regards
    Torbjørn

  • Hello Torbjorn,

    Thank you for the info. So the OV2640 came in and after initial setup everything is working! I should have just gone with the OV2640 from the start lol

    I will proceed now with the OV2640 for the eval, prototype phase. We will upgrade to the new Mega with latest nRF Connect SDK for the production versions.

    I have one issue though, sometimes the images captured come out like this:

      

    Partially missing. Doesn't matter which resolution or Phy setting I use.

    Is there a way to fix this issue?

    Please advise. Thanks!

    Adnan

  • Hi Adnan

    Good to hear that you got the OV2640 module working more easily Slight smile

    It looks like there is some data corruption in the transfer, which is causing the JPG decoding on the phone side to fail. Typically with JPG images a single corrupt byte will cause the rest of the image to be unrecoverable. 

    Data corruption over BLE is close to impossible, so most likely something is happening on the SPI bus. 

    Which supply voltage are you running the module at? 

    Could you try to reduce the SPI clock frequency by changing line 325 in ArduCAM.c? 

    Try with NRF_SPIM_FREQ_1M first, and if that doesn't help try something even lower such as NRF_SPIM_FREQ_250K. 

    Best regards
    Torbjørn

  • Hello Torbjorn

    I am using the VDD (PIN )output for the sensor power so under 3V (~2.7V). 

    Having said that, do you think it might still be a good idea to close the SB10 solder bridge on the DK to bring the voltage up to 3.3V? We will providing our own power supply anyways.

    For the NRF_SPIM_FREQ, I tried using NRF_SPIM_FREQ_2M but that did not give me any images at all, any ideas why? Dropping it to NRF_SPIM_FREQ_1M does seem to be working much better, no corrupted images yet.

    Please advise,

    Thanks!

    Adnan

Related