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

enable twim0

can somebody help me on how to enable twim0..

it was no problem in twi_sensor example...now i am integrating twi_sensor in ble_eddystone...and on built it give an error of "'NRF_DRV_TWI_INSTANCE_0' undeclared here (not in a function); did you mean 'NRF_DRV_TWI_INSTANCE_'?" i changed sdk
_config of eddystone too...  am i doing right..???

below is nrf_drv_twi.h file ...which shows that twim0 is not enabled..can you solve yhis problem..it would be great help..thank you.

  • Hi, 

    Could you try to enable TWI_ENABLED in the sdk_config.h?

    // <e> TWI_ENABLED - nrf_drv_twi - TWI/TWIM peripheral driver - legacy layer
    //==========================================================
    #ifndef TWI_ENABLED
    #define TWI_ENABLED 1
    #endif

    When you are integrating twi_sensor into ble_eddystone, you could refer to the sdk_config.h of twi_sensor.

    -Amanda H.

  • yes..i did all changes. ..now it is working...but the problem is that it reads the registers but all the valuse are getting in m_sample variable....i am returning *p_data from read function and have assigned a variable to catch values in..but they are not displaying in those variables....it is only remaining in m_sample..

    what could be the reason.??

    this is what i am doing 

    rslt_MSB = nrf_drv_vcnl4020_read_registers(0x87,&m_sample,1); // command to read result register 0x87 (MSB bits) of vcnl4020

    rslt_MSB = m_sample; //m_sample holds the values of result register..copy it to rslt_MSB variable.

    rslt_LSB = nrf_drv_vcnl4020_read_registers(0x88,&m_sample,1); //command to read result register 0x88 (LSB bits) of vcnl4020

    rslt_LSB = m_sample;

    am i doing it right ??

    and i have integrated twi_sensor into eddystone...can you halp..??

    Thank you.

  • my code is getting stuck at nrf_breakpoint_cond...

    i changed sdk_config.h as suggested 

    #ifndef NRF_LOG_ENABLED
    #define NRF_LOG_ENABLED 1

    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 1

    somebody can help???

    this is where code is stuck

      

    and it is the definition

    any help would be appriciated...thank you

  • Hi, 

    asmita_patil said:
    yes..i did all changes. ..now it is working...

    Good to hear it works. 

    nrf_drv_vcnl4020_read_registers() is not developed by us and out of our support.

    If you have further questions, please create new cases for them. They are already faraway to the title.   

     

    -Amanda H.

  • yes,,but inside nrf_drv_vcnl4020_read_registers() function i have used 

    err_code = nrf_drv_twi_tx(&m_twi_instance, vcnl4020_ADDRESS, &reg, 1, false);   and 

    err_code = nrf_drv_twi_rx(&m_twi_instance, vcnl4020_ADDRESS, p_data, length);  functions only..it is nothing different...

    which are originally 

    err_code = nrf_drv_twi_tx(&m_twi, LM75B_ADDR, reg, sizeof(reg), false); 

    and 

    ret_code_t err_code = nrf_drv_twi_rx(&m_twi, LM75B_ADDR, &m_sample, sizeof(m_sample));  functions used in sdk(LM75B example twi_sensor)

    i just created new function for my convenience..thats it..

Related