Dear Community,
I'm trying to use both datasheet-announced I2C interfaces, one as slave and one as master.
Datasheet: www.mouser.de/.../BlueNor_BM833A_datasheets-1627946.pdf Quote: "2X 2-wire Master/Slave (I 2 C compatible)" I'm able to use in SDK Config: // <e> NRFX_TWIM_ENABLED - nrfx_twim - TWIM peripheral driver //========================================================== #ifndef NRFX_TWIM_ENABLED #define NRFX_TWIM_ENABLED 0 #endif // <q> NRFX_TWIM0_ENABLED - Enable TWIM0 instance #ifndef NRFX_TWIM0_ENABLED #define NRFX_TWIM0_ENABLED 0 #endif #ifndef NRFX_TWIM1_ENABLED #define NRFX_TWIM1_ENABLED 0 #endif // <e> NRFX_TWIS_ENABLED - nrfx_twis - TWIS peripheral driver //========================================================== #ifndef NRFX_TWIS_ENABLED #define NRFX_TWIS_ENABLED 1 #endif // <q> NRFX_TWIS0_ENABLED - Enable TWIS0 instance #ifndef NRFX_TWIS0_ENABLED #define NRFX_TWIS0_ENABLED 1 #endif #ifndef NRFX_TWIS1_ENABLED #define NRFX_TWIS1_ENABLED 0 #endif =>This renders a working I2C slave interface. ********************************************** // <e> NRFX_TWIM_ENABLED - nrfx_twim - TWIM peripheral driver //========================================================== #ifndef NRFX_TWIM_ENABLED #define NRFX_TWIM_ENABLED 1 #endif // <q> NRFX_TWIM0_ENABLED - Enable TWIM0 instance #ifndef NRFX_TWIM0_ENABLED #define NRFX_TWIM0_ENABLED 1 #endif #ifndef NRFX_TWIM1_ENABLED #define NRFX_TWIM1_ENABLED 0 #endif // <e> NRFX_TWIS_ENABLED - nrfx_twis - TWIS peripheral driver //========================================================== #ifndef NRFX_TWIS_ENABLED #define NRFX_TWIS_ENABLED 0 #endif // <q> NRFX_TWIS0_ENABLED - Enable TWIS0 instance #ifndef NRFX_TWIS0_ENABLED #define NRFX_TWIS0_ENABLED 0 #endif #ifndef NRFX_TWIS1_ENABLED #define NRFX_TWIS1_ENABLED 0 #endif =>This renders a working I2C master interface. ********************************************** When I enable both TWIS/M0 instances, the linker complains: Output/Release/Obj/ble_app_uart_c_pca10056e_s140/nrfx_twis.o: in function `nrfx_twis_state_machine': multiple definition of `TWIM0_TWIS0_TWI0_SPIM1_SPIS1_SPI1_IRQHandler'; Output/Release/Obj/ble_app_uart_c_pca10056e_s140/nrfx_twim.o:/home/richard/nRF5_SDK_17.0.2_d674dde/modules/nrfx/drivers/src/nrfx_twim.c:846: first defined here When I enable one of the TWIS/M1 instances, here TWIS1, the compiler complains: Compiling 'nrfx_twis.c' In function ?nrfx_twis_1_irq_handler?: ‘NRF_TWIS1’ undeclared (first use in this function); did you mean ‘NRF_TWIS0’? Grepping in the nRF SDK module example for NRF_TWIS1 gave: grep -r 'NRF_TWIS1_BASE' . ./nrfx/mdk/nrf52840.h:#define NRF_TWIS1_BASE 0x40004000UL ./nrfx/mdk/nrf52840.h:#define NRF_TWIS1 ((NRF_TWIS_Type*) NRF_TWIS1_BASE) ./nrfx/mdk/nrf52.h:#define NRF_TWIS1_BASE 0x40004000UL ./nrfx/mdk/nrf52.h:#define NRF_TWIS1 ((NRF_TWIS_Type*) NRF_TWIS1_BASE) ./nrfx/mdk/nrf52820.h:#define NRF_TWIS1_BASE 0x40004000UL ./nrfx/mdk/nrf52820.h:#define NRF_TWIS1 ((NRF_TWIS_Type*) NRF_TWIS1_BASE) ./nrfx/mdk/nrf52833.h:#define NRF_TWIS1_BASE 0x40004000UL ./nrfx/mdk/nrf52833.h:#define NRF_TWIS1 ((NRF_TWIS_Type*) NRF_TWIS1_BASE) The program builds, when I add the defines like: #ifndef NRFX_TWIS1_ENABLED #define NRFX_TWIS1_ENABLED 0 #define NRF_TWIS1_BASE 0x40004000UL #define NRF_TWIS1 ((NRF_TWIS_Type*) NRF_TWIS1_BASE) #endif But then, the code is non-functional. I assume, that the BM833A has another NRF_TWIS1_BASE address, so I'm asking about that. Additionally, of course, I use the corresponding TWI-index in main.c: static const nrfx_twis_t m_twis = NRFX_TWIS_INSTANCE(0); //TWIS0_ENABLED 1=>INSTANCE(0) or TWIS1_ENABLED 1=>INSTANCE(1) static const nrfx_twim_t m_twi = NRFX_TWIM_INSTANCE(0); //TWIM0_ENABLED 1=>INSTANCE(0) or TWIM1_ENABLED 1=>INSTANCE(1)
Best regards,
Richard