Zephyr TWIM too slow so need to use NRFX driver

I have an application which is not able to talk with my gas gauge device when the TI EV2400 can. Looking at the waveforms all look the same except for the Zephyr code has a delay between the command byte & the register byte.

The command byte gets ACK'ed ok, but the register byte doesn't. When using the EV2400, the gas gauge stretches the clock duing the ACK bit, but the gas gauge does not streach the clock with the Zephyr code. I get a clock pulse with the same timing as the previous clock pulses & the registor byte is NACK'ed

The EV2400 & the nordic are both connected to the TWI at the same time so it's not the gas gauge device/circuit.

I don't know if this is the problem, but that's the only thing I can see wrong. I'm not expecting help with this, but I do need help with using the Nordic NRFX library directly (without Zepthr) in an attempt to remove this inter-byte delay & see if that fixes my problem.

I really up against is on time with this so I'm hopying for a simple, quick, solution

Thank you in advance

  • Just an udate. I've tried building the blocking & ono-blocking examples for the NRF52DK/52832.

    Firstly neither would build for 3.4.0 & I have to edit the overlay files to change "

    #include "../../../common/common-pinctrl.dtsi" to " #include "../common/common-pinctrl.dtsi"

    In file included from <command-line>:
    C:/Work/tx_rx_blocking_1/boards/nrf52dk_nrf52832.overlay:1:10: fatal error: ../../../common/common-pinctrl.dtsi: No such file or directory
    

    Working on the blocking sample

    Once built & connected 0.3 to 0.4 & 0.30 to 0.31 

    I then step thru (or run) and it hangs at 

    status = nrfx_twim_xfer(&twim_inst, &twim_xfer_desc, 0); (line 118)
  • Hi, 

    That happends, because when you hand the driver two seperate i2c_msg fragments, it sends each one as its own transfer and holds SCL low in between while the CPU catches up.

    If both is a write operation, you can try to put the bytes in one buffer and do a single i2c_write(). One transfer without a gap.

    If you attempt to do a write then read operation, you can either add compatible = "nordic,nrf-twi"; in your boards overlay files, or go to nrfx and use NRFX_TWIM_XFER_TXRX. This does a write then read as a single hardware transfer.

    are you doing two write operation or write then read? 

    Regards,

    Nissanth Karunanithy

Related