SOLVED - use the MKR1310 SPI Flash and the Modem

Hello,
I made a solution to use the MKR1310 SPI flash and the LoRaWAN modem together (without forcing the modem reset line).
The problem is related to the board design using the same wires for UART and SPI. You need to disconnect the UART from the SPI line to use the flash. For this I've modified the alternate abz modem firmware and added a new command to disconnect the UART. Then you can restore the UART state by putting the LORA_IRQ_DUMB line to LOW.

See how to use it above...

The firwmare can be downloaded here as pre-build for MKR1310 : GitHub - disk91/mkr1310_openLoRaModem_fw_update: MKR1310 OpenLoRaWanModem Firmware update

The source code of the firmware is here : GitHub - disk91/lora-modem-abz: Open LoRaWAN modem for Murata's Type ABZ wireless module

  pinMode(LORA_IRQ_DUMB, OUTPUT);
  digitalWrite(LORA_IRQ_DUMB, HIGH);
  SerialLoRa.begin(19200); 
  while(!SerialLoRa);
  SerialLoRa.println("AT$DISUART"); // request UART to disconnect
  delay(1000);

 // The flash can be used (Use Sparkfun flash lib)

  if ( !myFlash.begin(FLASH_CS,2000000,SPI1,SPI_MODE0) ) {
    Serial.println("Failed to init Flash module");
    while(true);
  }

  sfe_flash_manufacturer_e mfgID = myFlash.getManufacturerID();
  if (mfgID != SFE_FLASH_MFG_UNKNOWN)
  {
    Serial.print(F("Manufacturer: "));
    Serial.println(myFlash.manufacturerIDString(mfgID));
  } else {
    uint8_t unknownID = myFlash.getRawManufacturerID(); // Read the raw manufacturer ID
    Serial.print(F("Unknown manufacturer ID: 0x"));
    if (unknownID < 0x10) Serial.print(F("0")); // Pad the zero
    Serial.println(unknownID, HEX);
  }

 // Now we can restore the Uart to continue using the LoRa modem
  SerialLoRa.begin(19200); 
  while(!SerialLoRa);
  digitalWrite(LORA_IRQ_DUMB, LOW);
  delay(100); // let some time to apply

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.