This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to integrate twi code with another spi code

Hi,

I having an nrf52832 board and using gnu arm, nrfjprog to program the device. i reading data from two different sensors using spi and TWI in two different codes. now i need to combine the two project to one, so i tried to add the twi to the spi code but some error as shown below comes up. i have edited the makefile and sdk config files but not sure weather its correctly done.image description

I am editing the makefile and sdk line by line, is there any other way to do this ? something like a gui. i have attached the make fileMakefile and sdk filesdk_config.h(/attachment/f48c8b3e3463ecf6b44cd77adb15caa2)

Parents
  • SPI and TWI are shared resources. You cannot use SPI0 at the same time with twi0. You can use spi0 and twi1 or vice versa.

  • @madblue: This is stated in the Memory section of the nRF52832 Product Specification, here is the link. You will need to change either

    #define SPI_INSTANCE  0 /**< SPI instance index. */
    static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);
    

    or

    #define TWI_INSTANCE_ID     0
    static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);
    

    in your code to use another instance, e.g. TWI_INSTANCE_ID 1 in addition to enabling this in the sdk_config.h file.

Reply
  • @madblue: This is stated in the Memory section of the nRF52832 Product Specification, here is the link. You will need to change either

    #define SPI_INSTANCE  0 /**< SPI instance index. */
    static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);
    

    or

    #define TWI_INSTANCE_ID     0
    static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);
    

    in your code to use another instance, e.g. TWI_INSTANCE_ID 1 in addition to enabling this in the sdk_config.h file.

Children
No Data
Related