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

I need help with converting any example from Keil to SES

Hello,

I've been trying for days to convert any example from Keil to SES, I have road probably every question here on the dev zone but I am unable to fix this, I ever specially install windows on my mac to try if there it would work.

So, I have done everything from official nordic documents, I've been through several problems which I happily solve, but that I'm not able to.

I get those errors:


unplaced section: .log_dynamic_data_app [nrf_log_frontend.o], size=12, align=4

undefined symbol: __SRAM_segment_end__

undefined symbol: __start_log_const_data

undefined symbol: __start_log_dynamic_data

undefined symbol: __stop_log_const_data

I'm working on latest SEGGER, I have tried latest SDK, also 14.2 . The same errors. 

Thanks for reply

Parents
  • It seems like you are not using the correct startup code.  Startup code and linker scripts are different.  Startup code and linker script go in pair. You need to use the one made for SES.

  • Hey, I have followed instructions from here https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/segger-embedded-studio-a-cross-platform-ide but its a little bit outdated since now there is SES 4.50.

    Maybe there is a tutorial of how to rewrite programs from Keil to SES? Please like, I have spent so much hours for that, everyone seems get it done, and I am unable to transfer even Blinky example... 

  • There are no error. Everything is working.  The Timer is just a timer instance.  The Segger just break at instantiation of that object, nothing special.  Just continue execution.

  • Okay thanks, so what else could be causing the bool res = HardwareInit(); error? Something in the code? or connection mpu9250 to dev board? 

    Maybe there is a way to check whether dev board sees mpu9250 or not? 

  • Well, you have the debugger setup and running. Just step through and you will what happens.

  • Okay I will be trying, thanks.

    I have one question also,

    Can you explain me this lines 4 and 5? 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    static const I2CCFG s_I2cCfg = {
    0, // I2C device number
    {
    {I2C0_SDA_PORT, I2C0_SDA_PIN, I2C0_SDA_PINOP, IOPINDIR_BI, IOPINRES_PULLUP, IOPINTYPE_OPENDRAIN},
    {I2C0_SCL_PORT, I2C0_SCL_PIN, I2C0_SCL_PINOP, IOPINDIR_OUTPUT, IOPINRES_PULLUP, IOPINTYPE_OPENDRAIN},
    },
    115200, // Rate
    I2CMODE_MASTER,
    5, // Retry
    0, // Number of slave addresses
    {0,}, // Slave addresses
    true, // DMA
    false, // Use interrupt
    7, // Interrupt prio
    NULL // Event callback
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Especially this:
    I2C0_SDA_PORT, I2C0_SDA_PIN, I2C0_SDA_PINOP

    and

    I2C0_SCL_PORT, I2C0_SCL_PIN, I2C0_SCL_PINOP

    Because those are declared in board.h for board BLUEIO_TAG_BME680_PROTO

    here:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    //#define BLUEIO_TAG_BME680_PROTO
    #ifdef BLUEIO_TAG_BME680_PROTO
    #define I2C0_SDA_PORT BLUEIO_TAG_BME280_I2C_SDA_PORT
    #define I2C0_SDA_PIN BLUEIO_TAG_BME280_I2C_SDA_PIN
    #define I2C0_SDA_PINOP BLUEIO_TAG_BME280_I2C_SDA_PINOP
    #define I2C0_SCL_PORT BLUEIO_TAG_BME280_I2C_SCL_PORT
    #define I2C0_SCL_PIN BLUEIO_TAG_BME280_I2C_SCL_PIN
    #define I2C0_SCL_PINOP BLUEIO_TAG_BME280_I2C_SCL_PINOP
    #else
    #define I2C0_SDA_PORT BLUEIO_TAG_BME680_I2C_SDA_PORT
    #define I2C0_SDA_PIN BLUEIO_TAG_BME680_I2C_SDA_PIN
    #define I2C0_SDA_PINOP BLUEIO_TAG_BME680_I2C_SDA_PINOP
    #define I2C0_SCL_PORT BLUEIO_TAG_BME680_I2C_SCL_PORT
    #define I2C0_SCL_PIN BLUEIO_TAG_BME680_I2C_SCL_PIN
    #define I2C0_SCL_PINOP BLUEIO_TAG_BME680_I2C_SCL_PINOP
    #endif
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Why I am using some ports from different board than mine and bee 680 sensor for I2C configuration? Is this a must? Or I can delete it? Or change it anyway to be assigned to my board nrf 52 dk?


    And also this lines:
    Fullscreen
    1
    2
    3
    //#include "sensor.h"
    //#define AK0991x_DEFAULT_I2C_ADDR 0x0C /* The default I2C address for AK0991x Magnetometers */
    //#define AK0991x_SECONDARY_I2C_ADDR 0x0E /* The secondary I2C address for AK0991x Magnetometers */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Do I need to delete "//" and enable it? Or as I assume can I delete  it? Because mpu9250 has AK8963 magnetometer not a AK0991x.

  • That is the pins setting for the I2C and board.h is where you assign the pins for your board.  The example I created is for my boards. You define what ever your board is.

    also you rate setting is wrong, 115200 is uart rate.  For I2C try 100000 for 100KHz.

Reply
  • That is the pins setting for the I2C and board.h is where you assign the pins for your board.  The example I created is for my boards. You define what ever your board is.

    also you rate setting is wrong, 115200 is uart rate.  For I2C try 100000 for 100KHz.

Children
  • I have changed the rate settings thanks for that.

    I was trying to find out how to assign pins to my board but I have not idea. But For sure my board sees MPU9250 at adress 0x68 at pins 26,27 because I flashed twi_scanner example and got message that communication is or right.

    I've been looking on the internet for a while, and I really don't know what to do next, the code seems fine, the mpu9250 is connected to the right pins, but still failure to initialize hardware. It looks like the code do not listen to the right pins or something. 

    What would you recommend? I was also trying to debug it, but I don't know in what place should I look.

  • Check if that pin is not used for other thing in your code and check also it is assigned only to the I2C.

    I see in your snippet code that you didn't assign the pins to the I2C.

    Assign pins

    Fullscreen
    1
    2
    3
    4
    5
    6
    #define I2C0_SDA_PORT 0
    #define I2C0_SDA_PIN 26
    #define I2C0_SDA_PINOP 1
    #define I2C0_SCL_PORT 0
    #define I2C0_SCL_PIN 27
    #define I2C0_SCL_PINOP 1
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • I defined them like you said already, but still it's not working.


    I attach you my board.h and mot_sensor_demo.cpp maybe you will find something, and as you can see those pins are assign only for the I2C. 

    board.h

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    #ifndef __BOARD_H__
    #define __BOARD_H__
    #include "nrf.h"
    #define UART_TX_PIN 9
    #define UART_RX_PIN 11
    #define UART_RTS_PIN 8
    #define UART_CTS_PIN 10
    #define I2C0_SDA_PORT 0
    #define I2C0_SDA_PIN 26
    #define I2C0_SDA_PINOP 1
    #define I2C0_SCL_PORT 0
    #define I2C0_SCL_PIN 27
    #define I2C0_SCL_PINOP 1
    #endif // __BOARD_H__
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    mot_sensor_demo.cpp
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include <stdio.h>
    #include <atomic>
    #include <inttypes.h>
    #include "nrf.h"
    #include "coredev/iopincfg.h"
    #include "coredev/i2c.h"
    #include "coredev/uart.h"
    #include "iopinctrl.h"
    #include "timer_nrf5x.h"
    #include "sensors/agm_mpu9250.h"
    #include "imu/imu_mpu9250.h"
    #include "stddev.h"
    #include "timer_nrf5x.h"
    #include "idelay.h"
    #define MPU9250
    #include "board.h"
    std::atomic<bool> g_bTest(false);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    It seems like g_I2c with I2cCfg is bringing false. So, there is a problem with I2cCfg?
    ( res = g_I2c.Init(s_I2cCfg ); --> false 

  • You can trace into it to see what exactly is wrong.  I don't think I2C is returning false but it may not detect the sensor. Use the debugger and step into it. You will see why it returns false

  • I've been looking to it, setting couple breakpoints but actually It was my first time debugging such thing, and I do not know where to start, where set breakpoints and what to look for?

    Can you help me a little bit more?

    (And I checked twi_scanner example again, to be sure that's everything is  connected, and it is, twi_scanner discovers mpu9250 at 0x68)