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

continuous data about example twi_master_using_app_twi

hello. I want use I2C program. so, I used twi_master_using_app_twi example. SDA is output only 1byte(0x21). I need to output a continuous 5byte. Where do I need to modify the part. thank you.

Parents
  • I have some problem. const pointer(p_data) because, I still send one byte in twi_sensor example.

    ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * const p_instance,
                              uint8_t                     address,
                              uint8_t const *             p_data,
                              uint32_t                    length,
                              bool                        xfer_pending)
    {
        return twi_transfer(p_instance, address,
                            p_data, length,
                            xfer_pending, true);
    }
    

    so, modified source code from const pointer to array. but build is Not OK.

    ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * const p_instance,
                              uint8_t                     address,
                              uint8_t                      p_data[10],
                              uint32_t                    length,
                              bool                        xfer_pending)
    {
        return twi_transfer(p_instance, address,
                            p_data[10], length,
                            xfer_pending, true);
    }
    

    error messgae as below.

    ..........\components\drivers_nrf\twi_master\nrf_drv_twi.c(683): error: #167: argument of type "uint8_t" is incompatible with parameter of type "uint8_t *"

    what's mean?

  • #define DATA_ARRAY_LEN 10 uint8_t data[DATA_ARRAY_LEN] = {0x40, 0xC0, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x88}; #define MMA7660_ADDR (0x98U >> 1)

        err_code = nrf_drv_twi_tx(&m_twi_mma_7660, MMA7660_ADDR, data, DATA_ARRAY_LEN, true);
        			APP_ERROR_CHECK(err_code);
    

    I get one byte is link address as below. blog.naver.com/.../220723715390 SCLK is 9byte. is it right? please confirm it.

Reply Children
No Data
Related