Go Down

Topic: MKRfox1200 takes over SPI and pushes out my sensor (Read 1 time) previous topic - next topic

adam@adambrun.dk

I have a honeywell sensor connected via SPI on the MKRfox1200 ervery thing works perfect until I start using the sigfox commands. After Sigfox.begin() I loose contact to my SPI sensor.

I can see in the sigfox.h that it uses SPI for communication - but does that excludes other SPI sensor?

I can see some writing about messing up the usb connection which is solved by switching to battery operation. But that cannot solve the SPI connection.

Should I encapsulate with SPI.begin() and SPI.end()?

Is a SPI sensor on MKRfox1200 not an option after all?

Best regards
Adam


WillFG

I have exactly the same problem.

I'm wondering whether it was the SigFox SPI settings that don't match what is needed for the other device on the SPI bus (mine's an RFM69HCW).

#define SPICONFIG   SPISettings(100000UL, MSBFIRST, SPI_MODE0) is the setting for the SigFox module, which is pretty slow, as I understand it.

Did you get anywhere with this?

WillFG

Setting spi_port seems to be what is killing the initialization of my RFM69 so will see what that actually does.

int SIGFOXClass::begin()
{
#ifdef SIGFOX_SPI
  spi_port = SIGFOX_SPI;
  reset_pin = SIGFOX_RES_PIN;
  poweron_pin = SIGFOX_PWRON_PIN;
  interrupt_pin = SIGFOX_EVENT_PIN;
  chip_select_pin = SIGFOX_SS_PIN;
  led_pin = LED_BUILTIN;
#else
  // begin() can only be used on boards with embedded Sigfox module
  if (_configured == false) {
    return false;
  }
#endif

Edit: decided to use software SPI for the RFM69 in the end, still interested to know why this doesn't work.

timjacobs

#3
Aug 23, 2017, 11:55 am Last Edit: Aug 23, 2017, 02:07 pm by timjacobs
Hi all,

I had the same issue and tracked it down to a probable typo in the SigFox.h file of the Arduino SigFox library. Here, the spi_port is initialized by default to SPI (!), which means that reassigning it to SIGFOX_SPI in the SigFox.begin() method leads (I presume) to the original SPI to be deallocated - which in turn breaks regular SPI operations.

The answer is simple, just replace

Quote
SPIClass& spi_port = SPI;
by

Quote
SPIClass& spi_port = SIGFOX_SPI;
in SigFox.h and you're set.

I've forked and fixed it here: https://github.com/jacobstim/SigFox and initiated a pull request on the original Arduino repo to get it fixed.

Go Up