How to use additional SPI device with RFM69 repeater node?
-
My Hardware: Moteino R4, ATMEGA328P + RFM69HW
I have an issue when communicating with an additional SPI device. I have ADE7763 energy monitor SPI chip which operates on low clock speed.
When I read data from ADE7763, I reconfigure SPI settings as follows,
ADE7763
CS
pin connected toD9
.void loop() { updateVoltageCurrentData(); ..... ..... } void updateVoltageCurrentData() { SPI.beginTransaction(SPISettings(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE1)); uint8_t status = ADE_sampleRMS(&vrms, &irms); // reads VRMS and IRMS from ADE7763 SPI.endTransaction(); }
This settings working ok, but after some time, this particular node lost from RF network. Looks like RFM69 SPI settings corrupted.
Any recommended way to communicate with additional SPI device?
-
@jkandasa - Maybe this helps? Perhaps a speed issue causing packet collision?
https://www.raspberrypi.org/forums/viewtopic.php?p=347073
Are the devices using the same clock freq? Mught be worth adding a delay between command send/request to allow a change in clock to settle (if dynamic clock is even allowed in SPI)?
-
@jkandasa have you tried using software spi? For the slow device, it should work quite well I think.
-
@mfalkvidd That is a good idea to try.
@jkandasa Are you using pull up resistors on the CS lines to each device - that might be worth a try too....
-
@skywatch @mfalkvidd Thank you for your comments.
I am using Moteino R4 and RFM69 connected to hardware SPI pins. I tried the same pin with softSPI, but I could not get success.
Now I have altered the ADE7763 Arduino library to update SPI settings on every call. And added code to update the only flag on ADE7763 interrupt(like we have in RFM69_new library). Seems all look somewhat ok.
I think for RFM69 we use a default clock speed. for ADE7763: SPI_CLOCK_DIV4
Are you using pull up resistors on the CS lines to each device - that might be worth a try too....
Yes, I have