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

TWI-master integrate with Custom Service Code - NRF52 - SDK15.3.0

Hello,

i'm using,BMD-301(NRF52832),SDK15.3.0

////////////////////////.......Issue-1..............

When i upload "twi_master_using_nrf_twi_mngr" peripheral example

i'm getting this error in log

''''

TWI master example started.

<error> app: Fatal error

<warning> app: System reset

''''

Please help me to solve it.

////////////////////////.......Issue-2..............

another thing is

i have developed custom service code using template

now as per my application i have to do i2c communication between nrf52832 and stm32 .

nrf52832 will be i2c(twi)-master.

so for that i need to add i2c-master (twi-master) functionality in nrf52832.

so how i can able to add or merge twi-master.

what config need to change in sdkconfig.h

what code need to add in custom service code.

please help me.

thanks.

Parents
  • Hi,

    If you define DEBUG you should be able to find in app_error_fault_handler() what line of code is causing the error.

    You need to add all twi configuration you can find the in the sdk_config.h twi examples in the SDK to your project. As an example I suggest to look at \twi_scanner and \twi_sensor examples. 

    Best regards,
    Kenneth

  • Hello Kenneth,

    now code is working but when use

    following code to transmit data but it's stuck to  there and not transmit anything

    uint32_t err_code;
    uint8_t tx_data[] = {'a', 'b', 'c', 'd', 'e'};
    const nrf_drv_twi_t twi = NRF_DRV_TWI_INSTANCE(0);
    err_code = nrf_drv_twi_init(&twi, NULL, NULL);
    APP_ERROR_CHECK(err_code);
    nrf_drv_twi_enable(&twi);
    err_code = nrf_drv_twi_tx(&twi, SLAVE_ADDRESS, tx_data, sizeof(tx_data), false);
    APP_ERROR_CHECK(err_code);
    

    it stuck at

    err_code = nrf_drv_twi_tx(&twi,0x08, tx_data, sizeof(tx_data), false);

    i'm using this example

    "twi_master_using_nrf_twi_mngr"

Reply
  • Hello Kenneth,

    now code is working but when use

    following code to transmit data but it's stuck to  there and not transmit anything

    uint32_t err_code;
    uint8_t tx_data[] = {'a', 'b', 'c', 'd', 'e'};
    const nrf_drv_twi_t twi = NRF_DRV_TWI_INSTANCE(0);
    err_code = nrf_drv_twi_init(&twi, NULL, NULL);
    APP_ERROR_CHECK(err_code);
    nrf_drv_twi_enable(&twi);
    err_code = nrf_drv_twi_tx(&twi, SLAVE_ADDRESS, tx_data, sizeof(tx_data), false);
    APP_ERROR_CHECK(err_code);
    

    it stuck at

    err_code = nrf_drv_twi_tx(&twi,0x08, tx_data, sizeof(tx_data), false);

    i'm using this example

    "twi_master_using_nrf_twi_mngr"

Children
No Data
Related