Hello, I am trying to use the Swan with Note Carrier F and the I2C Qwik connector and having problems getting data to to the Swan
The setup is this:
Wemos D1 mini end, I2C Qwik connector connected to Groudn, SDA, SCL
Swan connected through the Qwik connector port
The Wemos is set up as the master and Swan is setup as the slave
with this setup I can transmit data via I2C from Wemos to Swan and it works fine
As soon as I add notecard.begin(0x17). the Swan stops responding to the I2C transmission from Wemos
I am using the following on the Swan side
Wire.begin(0x20);
Wire.onReceive(receiveEvent); // register event
The receiveEvent function processes incoming data when not initializing notecard and never seems to get called when I enable initializing the notecard even though data is being sent.
thanks for any help that can be provided
Hi @rksteeves
Let’s see if we can get this resolved!
Can I clarify some details:
Are you trying to communicate between the Swan and the Notecard, using the same I2C interface as the Wemos? If so, when you use notecard.begin(0x17)
, you are reconfiguring the I2C interface to act as a Master, so the Swan will no longer be able to receive data from the Wemos.
Thanks,
Alex
Well what you are saying makes sene, but I am not sure I know the answer. The notecard is wired to the F carrier board and I am simply using the provided Qwik connectors to connect the Wemos via I2C. When you say same interface, do you mean the same SDA/SCL on the Swan side? Perhaps one of the Blues people are familiar with the notecard I2C config
@rksteeves the Swan is connected to the Notecard (internally) via the I2C bus, which is the same physical I2C bus that is connected through to the QWIIC connector. It sounds like you are configuring the Swan to be an I2C Master when you run the notecard.begin(0x17)
function and thus the Swan is no longer listening for I2C commands from the Wemos (as it previously did in Slave mode).
My suggestion would be to use Serial (UART) to communicate between the Swan and the Notecard (like this user is doing), allowing you to keep the Swan as an I2C Slave. You will need a physical connection (e.g. three jumper wire) between the N_RX
-F_TX
and N_TX
-F_RX
pins as well as GND.
Alternatively, if you want to do everything over I2C, you will need to use a different set of I2C pins for the Wemos (not the QWIIC connector) that are not connected on the same I2C bus as the Notecard. Your architecture would then look like:
Wemos (Master I2C_BUS_0)
Swan (Slave to Wemos I2C_BUS_0, Master to Notecard I2C_BUS_1)
Notecard (Slave I2C_BUS_1)
If you’d like me to provide you with more information on how to set up multiple I2C buses, let me know!
Alex
If I understand correctly, setting up an alternative I2C bus would be done with Wire.being(AlternaSDA, AlternatSCL). Of course connecting to alternate SDA/SCL pins
However, in looking at the NoteCard F although there are 2 sets of SDA/SCL (N_SDA/N_SCL & F_SDA/F_SCL), they are the same with the N_SDA/SCL having a 10k pullup resistor? is this correct, or is there another way to setup separate I2C with the swan/Notecarrier F?
You are correct, you would need to use Wire.begin(I2C_SDA_1, I2C_SCL_1) on alternative pins. The N_
and F_
I2C buses are connected, so you would need to remap two of the Digital GPIO of the Swan as a new I2C bus. They would also require their own pullup resistors.
Unfortunately, the other physical I2C buses are not exposed on the Notecarrier F board (only on the castellated edges of the Swan), so you would instead need to use a Software I2C implementation, which is a bit more complicated when using the Slave mode.
Could you use UART as an alternative? It would certainly be easier to implement than Software I2C.
I think I am going to test it out using the serial interface for the notecard and keep the I2c for the wemos to swan. To be honest, I didn’t initially follow your description for this one and then all of a sudden I got it.
I will try the Uart to test but I am currently using the rx/tx for a Bluetooth device so maybe I will have to move to softwareserial for the the additional serial for the Bluetooth device
Thanks for you help!
Randy
1 Like