Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. How to use soft SPI to connect my sensor chip while hard SPI is used for radio?

How to use soft SPI to connect my sensor chip while hard SPI is used for radio?

Scheduled Pinned Locked Moved Development
4 Posts 2 Posters 977 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Jimy AguirreJ Offline
    Jimy AguirreJ Offline
    Jimy Aguirre
    wrote on last edited by
    #1

    Hello, I have to say Thanks to Hek and all the MySensors team for this useful work, You are a great team guys!.
    I have designed a nice PCB, I already have received this from PCBWay and I am ready to solder it. This board has a NRF24L01 connected to the SPI on Arduino pro-mini pins, same as described in “connecting radio” in the MySensors build section. The board also has an Atmel chip ATM90E26A, a smart metering chip. My intention is to make a mysensor energy smart meter. This ATM90E26 has SPI pins connected to Arduino pro-mini pins as follow:
    -- MOSI to pin D5
    -- MISO to pin D6
    -- CLK to pin D7
    -- CS to pin D8
    I did these connections because I though this will prevent problems of SPI sharing and different SPI settings, (I though It can be better if I use MySensors soft_SPI for the energy chip, I though it would be easy to declare in the sketch) but now I am in trouble because I have spend a lot of time trying to make it work unsuccessfully. I cannot re assign the hardware connections pins because the PCB is now done. It is my mistake I should have tested it in a protoboard before to design the PCB. Then any hardware changes cannot be made.
    I see that MySensor library can set SOFT_SPI pins but when you declare your radio type or gateway type, this SPI is assigned to the radio. My question is How to use soft SPI for my sensor chip and the hard SPI for the radio? Thank in advance, Please help me.

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      Hi.

      The devices should be able to share the hardware SPI, but some hardware and libraris don't play well on a shared SPI so using software SPI might be easier. And since the PCB is done, I guess Software SPI is the only option anyway unless you patch the board (which could be an option).

      Are you using a library for the ATM90E26A? If so, does that library support Soft SPI? If it does, all you should need to do is to include a Soft SPI library and instruct the ATM90E26A library to use the Soft SPI instance. MySensors would not be affected at all; just like it wouldn't be affected by connecting something using oneWire or SoftSerial.

      Jimy AguirreJ 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        Hi.

        The devices should be able to share the hardware SPI, but some hardware and libraris don't play well on a shared SPI so using software SPI might be easier. And since the PCB is done, I guess Software SPI is the only option anyway unless you patch the board (which could be an option).

        Are you using a library for the ATM90E26A? If so, does that library support Soft SPI? If it does, all you should need to do is to include a Soft SPI library and instruct the ATM90E26A library to use the Soft SPI instance. MySensors would not be affected at all; just like it wouldn't be affected by connecting something using oneWire or SoftSerial.

        Jimy AguirreJ Offline
        Jimy AguirreJ Offline
        Jimy Aguirre
        wrote on last edited by
        #3

        @mfalkvidd Thank you for answer. Yes, I am using a library for the ATM90E26A that is in github written by Tisham Dhar whatnick it support UART and SPI for this chip but not softSPI.
        I was making some code experiments using other softSPI libraries trying to combine them to make the ATM90E26A works with softSPI. I tried to use also digitalIO and other for RFID using SoftSPI, no successful and probably I will have to contact to Tisham Dhar for SoftSPI implementation in the ATM90E26A library.
        I was thinking (when I design the PCB) is to use the MySensors Soft_SPI feature to read the energy chip, but now as you said, I understand it need to be supported in the ATM90E26A library and not in the MySensor library. Anyway if anyone of you has any idea please let me know, I will be happy to try it. If the ATM90E26A library got softSPI support I will update this post. Many thanks.

        Jimy AguirreJ 1 Reply Last reply
        1
        • Jimy AguirreJ Jimy Aguirre

          @mfalkvidd Thank you for answer. Yes, I am using a library for the ATM90E26A that is in github written by Tisham Dhar whatnick it support UART and SPI for this chip but not softSPI.
          I was making some code experiments using other softSPI libraries trying to combine them to make the ATM90E26A works with softSPI. I tried to use also digitalIO and other for RFID using SoftSPI, no successful and probably I will have to contact to Tisham Dhar for SoftSPI implementation in the ATM90E26A library.
          I was thinking (when I design the PCB) is to use the MySensors Soft_SPI feature to read the energy chip, but now as you said, I understand it need to be supported in the ATM90E26A library and not in the MySensor library. Anyway if anyone of you has any idea please let me know, I will be happy to try it. If the ATM90E26A library got softSPI support I will update this post. Many thanks.

          Jimy AguirreJ Offline
          Jimy AguirreJ Offline
          Jimy Aguirre
          wrote on last edited by Jimy Aguirre
          #4

          @jimy-aguirre I have contacted Tisham the ATM90E26 smart energy chip Arduino library author. He suggest to submit an issue against the library in github to request the softSPI feature support by the library, then I did it, here it is the link. If anyone can write any suggestion or constructive comment on github it is very welcome.
          Of course if there is any "alternatively solution" to assign the mysensors library softSPI pins to the sensor chip and it works while the radio is connected to the SPI (hardware SPI) I will be happy to test it.
          Thanks to all.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          12

          Online

          11.7k

          Users

          11.2k

          Topics

          113.1k

          Posts


          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular