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

nRF9160 modem access via I2C (vs. UART)

Hi,

I am looking to access nRF9160 modem via I2C. Essentially looking for hooks/ serial interface hand-off points used
for instance in AT Client sample or Serial LTE Modem app? So I could replace UART with I2C based host interface.

Wondering if it may be as simple as modifying slm_at_host.c/.h in nrf\applications\serial_lte_modem\src - replacing 
instances of uart_ buffers and handler functions in slm_at_host with i2c? Other modifications needed? Or, perhaps
a different host interface porting approach you want to recommend? Any help, pointers, sample code will be greatly
appreciated.

Please advise. Thanks.

Parents
  • I looked around and I could or any work being done regarding this. But it should be possible to swap the UART communication with I2C, to relay the AT commands to and from the modem. in the at_client sample, the library at_host.c needs to be rewritten and in the serial_lte_modem application slm_at_host.c needs to be rewritten as I understand it.

    Currently, a huge portion of the support team is on summer vacation and you may experience delayed replies. My apologies for that.

    I will ask the developers responsible for the mentioned libraries and ask if there is planned to do anything to support I2C. If not I will try to help you in more detail on how to rewrite the libraries.

    Best regards,

    Simon

  • Thanks Simon,

    Understood. Any pointers, samples toward helping me build/ customize host-side interface library function 
    (especially for slm app) would be greatly appreciated.

    From project timeline, estimation standpoint, curious when's the summer break expected to end, typically?

    Best,
    SE

Reply Children
  • I took a look at the file nrf\applications\serial_lte_modem\src\slm_at_host.c and tried to figure out how to go about this.

    I'm not sure if you've thought about the roles, but one way of going about it is to let the nRF9160 be the master while the other device is the slave. Then you could use some kind of interrupt lines to signal the master that the data (AT command) is ready. The nRF9160 could then read the data, byte by byte, and send a response back.

    From the nRF9160 read all the data at once using i2c_read(), or maybe byte by byte by using something like this. However, you have to process the data like it's done in slm_at_host.c-->uart_rx_handler(..) (check if termination character is the same as set in prj.conf/Kconfig).

    When the whole AT command is received and processed you store it in the buffer at_buf[], and run k_work_submit(&cmd_send_work), which will send the data (AT command) stored in at_buf[] to the modem.

    The next step is to send the response, but try implementing this first and see how it goes.

    However, I am not too familiar with the library slm_at_host.c so there may be weaknesses with my explanations.

    Regarding the summer break, most of the people will be back at the end of July (27th) and the beginning of August.

    Best regards,

    Simon

Related