Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Karl-Heinz K
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Karl-Heinz K

    @Karl-Heinz K

    7
    Reputation
    9
    Posts
    253
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Karl-Heinz K Follow

    Best posts made by Karl-Heinz K

    • RE: How to add support for SAM D51/Cortex M4?

      Hallo Mikael,
      thank you for your hint.

      I modified the hwCPUVoltage() part of MyHwSAMD.cpp like this. It works for me. Maybe it is not the best solution, however.

      Sincerely

      Karl-Heinz

      uint16_t hwCPUVoltage()
      {
      	#ifdef __SAMD51__ 
      	   return FUNCTION_NOT_SUPPORTED;
      	#else
      
      	// disable ADC
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->CTRLA.bit.ENABLE = 0x00;
      
      	// internal 1V reference (default)
      	analogReference(AR_INTERNAL1V0);
      	// 12 bit resolution (default)
      	analogWriteResolution(12);
      	// MUXp 0x1B = SCALEDIOVCC/4 => connected to Vcc
      	ADC->INPUTCTRL.bit.MUXPOS = 0x1B ;
      
      	// enable ADC
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->CTRLA.bit.ENABLE = 0x01;
      	// start conversion
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->SWTRIG.bit.START = 1;
      	// clear the Data Ready flag
      	ADC->INTFLAG.bit.RESRDY = 1;
      	// start conversion again, since The first conversion after the reference is changed must not be used.
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->SWTRIG.bit.START = 1;
      
      	// waiting for conversion to complete
      	while (!ADC->INTFLAG.bit.RESRDY);
      	const uint32_t valueRead = ADC->RESULT.reg;
      
      	// disable ADC
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->CTRLA.bit.ENABLE = 0x00;
      
      	return valueRead * 4;
              #endif
      }
      
      posted in Hardware
      Karl-Heinz K
      Karl-Heinz K
    • Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Since it took me some time to find a solution to the problem that my Raspberry Pi Gateway couldn't connect to the Adafruit RFM69HCW module, I wanted to share my solution here with everyone to save others the loss of time.

      I followed exactly the instructions in this tutorial:
      https://www.mysensors.org/build/raspberry
      I used MySensors version 2.3.0.

      During my attempts to narrow down the error, I was able following these instructions: http://www.kittley.com/2018/04/05/blog-rfm69-pi/ to confirm that my hardware is working.

      The main difference between the two tutorials concerns the RESET pin of the Adafruit RFM69HCW module.

      The MySensor manual does not use the RESET pin. Without really understanding what I am doing, I modified the configure file via pattern recognition and created the possibility to pass the RESET pin to the program.

      For this I had to add two lines to the configure file:

      --my-rfm69-rst-pin=<PIN> Pin number to use for RFM69 Chip-Select.

      --my-rfm69-rst-pin=*)
      CPPFLAGS="-DMY_RFM69_RST_PIN=${optarg} $CPPFLAGS"

      Simply search for my-rfm69-cs-pin and add the respective line afterwards.

      --my-rfm69-cs-pin=<PIN> Pin number to use for RFM69 Chip-Select.
      --my-rfm69-rst-pin=<PIN> Pin number to use for RFM69 Chip Select.
      
      --my-rfm69-cs-pin=*)
          CPPFLAGS="-DMY_RFM69_CS_PIN=${optarg} $CPPFLAGS""
          ;;
      --my-rfm69-rst-pin=*)
          CPPFLAGS="-DMY_RFM69_RST_PIN=${optarg} $CPPFLAGS"
          ;;
      

      I have made my pin assignment according to the instructions of Jacob Kittley (http://www.kittley.com/2018/04/05/blog-rfm69-pi/ )

      The call for configure is for an MQTT gateway:

      ./configure --my-transport=rfm69 --my-rfm69-frequency=915 --my-is-rfm69hw --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --my-rfm69-irq-pin=18 --my-rfm69-cs-pin=24 --my-rfm69-rst-pin=29

      It would be good to include these hints in the MySensors tutorial. But I don't know how to do that.

      Many greetings

      Karl-Heinz

      Translated with www.DeepL.com/Translator

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Dear Mikael,

      you are so quick. Impressive!

      When I read the tutorial I did not understand the meaning and the potential of the "Advanced" section. Now it is much clearer for me.

      I did some research myself but did not find a definite answer neither from Adafruit (documentation and forum) nor in the Hopfer datasheet of the RFM69HCW. However, I found the same hints in the forum as you did.

      This statement from Tekka "Leaving RST floating could cause a problem." makes me think that is would be a good idea to include the two lines which I suggested to the configure file in the github repository for the next release.

      In addition, at least two tutorial pages on the MySensors website should be modified:

      https://www.mysensors.org/build/raspberry
      https://www.mysensors.org/build/orange

      In the section https://www.mysensors.org/build/raspberry#wiring I would just add a line with a pin assignment for RST to this table:

      RFM69 Radio

      Raspberry RFM69 Color
      GND GND Black
      3.3V VCC Red
      24 NSS Yellow
      23 SCK Green
      19 MOSI Blue
      21 MISO Violet
      22 DI00 Gray
      29 RST
      (*) ANA Antenna

      For example "29 RST"... 29 or it could be also any other pin.

      In addition I would add just another example line for the RFM69 configuration command where the pins are explicitely assigned to this section of the tutorials:

      https://www.mysensors.org/build/raspberry#configure

      RFM69
      --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw

      --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-rfm69-irq-pin=22 --my-rfm69-cs-pin=24 --my-rfm69-rst-pin=29

      Maybe you could add a short sentence like "It is recommended to explicitly assign the pins if you have problems communicating with the radio module".

      I think this should do it for all those who follow the tutorials.

      Sincerely

      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Dear Mikael,
      I did not recompile the program.
      I moved the RSTpin from pin 29 to GND (pin 30) and mysgw works as you expected!
      It seems to be an alternative for Adafruit RFM69 breakout board users to recommend to tie the RST pin to ground!
      Thanks a lot for this analysis.
      Sincerely
      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Dear Mikael,
      excellent solution! Nothing to add! Perfect to the point!
      Thank you very much for your great support!
      Sincerely
      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Ethernet W5100 gateway IP problem

      @wmmhome

      Hello,

      could it be that your problem is related to the SPI issue which was discussed in this thread:

      W5100 Ethernet gateway with RFM69 Radio fails at init

      The suggested patches helped me a lot.

      In addition: When I built my W5100 gateway I could not use the Arduino Nano, I had to switch to an Arduino Mega. The nano had not enough memory available for my project using an RFM69 AND the W5100 ethernet shield. The nano started to work, but after some 10 - 15 min the stack ran out of memory and the nano crashed. But it was not so obvious in the beginning when I started to debug the project at that time. Maybe you ran into a similar problem.

      Sincerely

      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Ethernet W5100 gateway IP problem

      Dear Wayne,

      I copy my documentation for the Arduino Mega which I put in the header of my sketch (which means I did not think through all details again for this post, just wanted to help quickly) at the end of this post. It will help if you use an Arduino Mega. It might also help if you use an Arduino Nano.

      During my experiments I also made the following note to myself (did not validate all details though):

      " // final conclusion:
      // ==============
      // the Arduino Nano was not stable. Probably because it was low on SRAM.
      // However, for the Arduino Nano test I did not use the SPI patched RFM69 Library -> could improve stability
      // and I did not try to use an ethernet library with a smaller footprint -> could improve stability, too"

      Currently I use these libraries:

      #include <RFM69.h>
      #include <SPI.h>
      #include <Ethernet.h>
      

      I hope this points to the right direction.

      I currently use the Computourist RFM69 MQTT gateway sketch (get it here: https://github.com/computourist/RFM69-MQTT-client). But it is on my agenda to change all my code to MySensors. I just did not have time to do it. Anyway, long story short, if you send me a PM with an email address I could send you my sketch if you are interested. The code is not well structured currently, however, therefore I do not what to share it publicly.

      Sincerely

      Karl-Heinz

      KH: quick and dirty documentation (end of 2017):

      /*  Connect Arduino Mega:
       *  EthernetShield Labels = Mega Labels
      
       *  5V              = 5V
       *  GND             = GND
       *  IRQ = D2        = 2
       *  RST =           = 4	
       *  SCL = D13       = 52
       *  CS              = 8
       *  Miso = D12      = 50
       *  Mosi = D11      = 51
       */
      
      
      /*This sketch only works under the following conditions:*/
      /*============================================*/
      
      /*1) An Arduino Mega must be used due to memory problems of Uno/Nano (SRAM)
         and it has to be an EthernetShield with W5100 chip, but it should be the newer 
        version of the EthernetShield, because older versions have the SPI
         interface permanently blocked by the EthernetShield. Only after a
         hardware modification at the SENS pin of the W5100 chip the blocking is no longer the case.
         
       2) the RFM69 Library of LowPowerLabs does not yet (end of 2017) contain all
          necessary adaptations, so that SPI conflicts between the Ethernet card
          and the RFM69 module can be solved.
      
          There is a patched version for this purpose:
      
             https://github.com/rrobinet/RFM69_Libary
      
        3) The original Ethernet Library of the Arduino IDE does not consider the Arduino IDE's 
           own current SPI library and must also be patched. 
           
           Copy from the Internet:
      
      	"[Changes to the Ethernet Library](http://harizanov.com/2012/04/rfm12b-and-arduino-ethernet-with-wiznet5100-chip/)
      	
      	 I edited the Arduino Ethernet library file W5100.h so that it doesn’t
      	allow RFM12b to interrupt while the SPI bus is busy handling Wiznet5100.
      	I added a cli(); and sei(); as follows in the W5100 library."
      
      
      	für Arduino Mega...
      	[Reference](https://lowpowerlab.com/forum/moteino/moteino-w5100-ethernet-spi-support-spi_has_transaction/60/):
      
      	In my case using an ATMEGA2560 changing the W5100.h library from:
      
      	    #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
      	      inline static void initSS()    { DDRB  |=  _BV(4); };
      	      inline static void setSS()     { PORTB &= ~_BV(4); };
      	      inline static void resetSS()   { PORTB |=  _BV(4); };
      	To
      	    #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
      	      inline static void initSS()    { DDRB  |=  _BV(4); };
      	      inline static void setSS()     { cli ();PORTB &= ~_BV(4); };
      	      inline static void resetSS()   { PORTB |=  _BV(4); sei();};"*/```
      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K

    Latest posts made by Karl-Heinz K

    • RE: ESP8266 Gateway with local sensors stuck in loop

      @ShadeX12
      Hello,

      maybe these links will provide the necessary background information to solve your problem:

      Basics about ESP8266 sleep modes:

      https://www.losant.com/blog/making-the-esp8266-low-powered-with-deep-sleep

      Extensive discussion of this topic:

      https://github.com/esp8266/Arduino/issues/1488

      Especially this citation might be interesting:

      "GPIO16 is connected to CH_DP for deepSleep.
      and pulled low during deepSleep.
      if CH_DP goes high the chip wakes up.
      for what reason the high signal comes from does not mater.
      can be the RTC timer or any other electrical stuff connected to CH_DP.
      so adding a pullup to CH_DP and a switch that is normally close to GPIO16 will work fine."

      Excellent summary, how to work with interrupts in general on the ESP8266:

      https://techtutorialsx.com/2016/12/11/esp8266-external-interrupts/

      Good luck with your project.

      Karl-Heinz

      shayo created this issue in esp8266/Arduino

      closed Deep sleep and wake up using interrupt #1488

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Ethernet W5100 gateway IP problem

      Dear Wayne,

      I copy my documentation for the Arduino Mega which I put in the header of my sketch (which means I did not think through all details again for this post, just wanted to help quickly) at the end of this post. It will help if you use an Arduino Mega. It might also help if you use an Arduino Nano.

      During my experiments I also made the following note to myself (did not validate all details though):

      " // final conclusion:
      // ==============
      // the Arduino Nano was not stable. Probably because it was low on SRAM.
      // However, for the Arduino Nano test I did not use the SPI patched RFM69 Library -> could improve stability
      // and I did not try to use an ethernet library with a smaller footprint -> could improve stability, too"

      Currently I use these libraries:

      #include <RFM69.h>
      #include <SPI.h>
      #include <Ethernet.h>
      

      I hope this points to the right direction.

      I currently use the Computourist RFM69 MQTT gateway sketch (get it here: https://github.com/computourist/RFM69-MQTT-client). But it is on my agenda to change all my code to MySensors. I just did not have time to do it. Anyway, long story short, if you send me a PM with an email address I could send you my sketch if you are interested. The code is not well structured currently, however, therefore I do not what to share it publicly.

      Sincerely

      Karl-Heinz

      KH: quick and dirty documentation (end of 2017):

      /*  Connect Arduino Mega:
       *  EthernetShield Labels = Mega Labels
      
       *  5V              = 5V
       *  GND             = GND
       *  IRQ = D2        = 2
       *  RST =           = 4	
       *  SCL = D13       = 52
       *  CS              = 8
       *  Miso = D12      = 50
       *  Mosi = D11      = 51
       */
      
      
      /*This sketch only works under the following conditions:*/
      /*============================================*/
      
      /*1) An Arduino Mega must be used due to memory problems of Uno/Nano (SRAM)
         and it has to be an EthernetShield with W5100 chip, but it should be the newer 
        version of the EthernetShield, because older versions have the SPI
         interface permanently blocked by the EthernetShield. Only after a
         hardware modification at the SENS pin of the W5100 chip the blocking is no longer the case.
         
       2) the RFM69 Library of LowPowerLabs does not yet (end of 2017) contain all
          necessary adaptations, so that SPI conflicts between the Ethernet card
          and the RFM69 module can be solved.
      
          There is a patched version for this purpose:
      
             https://github.com/rrobinet/RFM69_Libary
      
        3) The original Ethernet Library of the Arduino IDE does not consider the Arduino IDE's 
           own current SPI library and must also be patched. 
           
           Copy from the Internet:
      
      	"[Changes to the Ethernet Library](http://harizanov.com/2012/04/rfm12b-and-arduino-ethernet-with-wiznet5100-chip/)
      	
      	 I edited the Arduino Ethernet library file W5100.h so that it doesn’t
      	allow RFM12b to interrupt while the SPI bus is busy handling Wiznet5100.
      	I added a cli(); and sei(); as follows in the W5100 library."
      
      
      	für Arduino Mega...
      	[Reference](https://lowpowerlab.com/forum/moteino/moteino-w5100-ethernet-spi-support-spi_has_transaction/60/):
      
      	In my case using an ATMEGA2560 changing the W5100.h library from:
      
      	    #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
      	      inline static void initSS()    { DDRB  |=  _BV(4); };
      	      inline static void setSS()     { PORTB &= ~_BV(4); };
      	      inline static void resetSS()   { PORTB |=  _BV(4); };
      	To
      	    #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
      	      inline static void initSS()    { DDRB  |=  _BV(4); };
      	      inline static void setSS()     { cli ();PORTB &= ~_BV(4); };
      	      inline static void resetSS()   { PORTB |=  _BV(4); sei();};"*/```
      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Ethernet W5100 gateway IP problem

      @wmmhome

      Hello,

      could it be that your problem is related to the SPI issue which was discussed in this thread:

      W5100 Ethernet gateway with RFM69 Radio fails at init

      The suggested patches helped me a lot.

      In addition: When I built my W5100 gateway I could not use the Arduino Nano, I had to switch to an Arduino Mega. The nano had not enough memory available for my project using an RFM69 AND the W5100 ethernet shield. The nano started to work, but after some 10 - 15 min the stack ran out of memory and the nano crashed. But it was not so obvious in the beginning when I started to debug the project at that time. Maybe you ran into a similar problem.

      Sincerely

      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Dear Mikael,
      excellent solution! Nothing to add! Perfect to the point!
      Thank you very much for your great support!
      Sincerely
      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Dear Mikael,
      I did not recompile the program.
      I moved the RSTpin from pin 29 to GND (pin 30) and mysgw works as you expected!
      It seems to be an alternative for Adafruit RFM69 breakout board users to recommend to tie the RST pin to ground!
      Thanks a lot for this analysis.
      Sincerely
      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Dear Mikael,

      you are so quick. Impressive!

      When I read the tutorial I did not understand the meaning and the potential of the "Advanced" section. Now it is much clearer for me.

      I did some research myself but did not find a definite answer neither from Adafruit (documentation and forum) nor in the Hopfer datasheet of the RFM69HCW. However, I found the same hints in the forum as you did.

      This statement from Tekka "Leaving RST floating could cause a problem." makes me think that is would be a good idea to include the two lines which I suggested to the configure file in the github repository for the next release.

      In addition, at least two tutorial pages on the MySensors website should be modified:

      https://www.mysensors.org/build/raspberry
      https://www.mysensors.org/build/orange

      In the section https://www.mysensors.org/build/raspberry#wiring I would just add a line with a pin assignment for RST to this table:

      RFM69 Radio

      Raspberry RFM69 Color
      GND GND Black
      3.3V VCC Red
      24 NSS Yellow
      23 SCK Green
      19 MOSI Blue
      21 MISO Violet
      22 DI00 Gray
      29 RST
      (*) ANA Antenna

      For example "29 RST"... 29 or it could be also any other pin.

      In addition I would add just another example line for the RFM69 configuration command where the pins are explicitely assigned to this section of the tutorials:

      https://www.mysensors.org/build/raspberry#configure

      RFM69
      --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw

      --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-rfm69-irq-pin=22 --my-rfm69-cs-pin=24 --my-rfm69-rst-pin=29

      Maybe you could add a short sentence like "It is recommended to explicitly assign the pins if you have problems communicating with the radio module".

      I think this should do it for all those who follow the tutorials.

      Sincerely

      Karl-Heinz

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • Fix for Raspberry Pi Gateway with Adafruit RFM69HCW

      Since it took me some time to find a solution to the problem that my Raspberry Pi Gateway couldn't connect to the Adafruit RFM69HCW module, I wanted to share my solution here with everyone to save others the loss of time.

      I followed exactly the instructions in this tutorial:
      https://www.mysensors.org/build/raspberry
      I used MySensors version 2.3.0.

      During my attempts to narrow down the error, I was able following these instructions: http://www.kittley.com/2018/04/05/blog-rfm69-pi/ to confirm that my hardware is working.

      The main difference between the two tutorials concerns the RESET pin of the Adafruit RFM69HCW module.

      The MySensor manual does not use the RESET pin. Without really understanding what I am doing, I modified the configure file via pattern recognition and created the possibility to pass the RESET pin to the program.

      For this I had to add two lines to the configure file:

      --my-rfm69-rst-pin=<PIN> Pin number to use for RFM69 Chip-Select.

      --my-rfm69-rst-pin=*)
      CPPFLAGS="-DMY_RFM69_RST_PIN=${optarg} $CPPFLAGS"

      Simply search for my-rfm69-cs-pin and add the respective line afterwards.

      --my-rfm69-cs-pin=<PIN> Pin number to use for RFM69 Chip-Select.
      --my-rfm69-rst-pin=<PIN> Pin number to use for RFM69 Chip Select.
      
      --my-rfm69-cs-pin=*)
          CPPFLAGS="-DMY_RFM69_CS_PIN=${optarg} $CPPFLAGS""
          ;;
      --my-rfm69-rst-pin=*)
          CPPFLAGS="-DMY_RFM69_RST_PIN=${optarg} $CPPFLAGS"
          ;;
      

      I have made my pin assignment according to the instructions of Jacob Kittley (http://www.kittley.com/2018/04/05/blog-rfm69-pi/ )

      The call for configure is for an MQTT gateway:

      ./configure --my-transport=rfm69 --my-rfm69-frequency=915 --my-is-rfm69hw --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --my-rfm69-irq-pin=18 --my-rfm69-cs-pin=24 --my-rfm69-rst-pin=29

      It would be good to include these hints in the MySensors tutorial. But I don't know how to do that.

      Many greetings

      Karl-Heinz

      Translated with www.DeepL.com/Translator

      posted in Troubleshooting
      Karl-Heinz K
      Karl-Heinz K
    • RE: How to add support for SAM D51/Cortex M4?

      Hallo Mikael,
      thank you for your hint.

      I modified the hwCPUVoltage() part of MyHwSAMD.cpp like this. It works for me. Maybe it is not the best solution, however.

      Sincerely

      Karl-Heinz

      uint16_t hwCPUVoltage()
      {
      	#ifdef __SAMD51__ 
      	   return FUNCTION_NOT_SUPPORTED;
      	#else
      
      	// disable ADC
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->CTRLA.bit.ENABLE = 0x00;
      
      	// internal 1V reference (default)
      	analogReference(AR_INTERNAL1V0);
      	// 12 bit resolution (default)
      	analogWriteResolution(12);
      	// MUXp 0x1B = SCALEDIOVCC/4 => connected to Vcc
      	ADC->INPUTCTRL.bit.MUXPOS = 0x1B ;
      
      	// enable ADC
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->CTRLA.bit.ENABLE = 0x01;
      	// start conversion
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->SWTRIG.bit.START = 1;
      	// clear the Data Ready flag
      	ADC->INTFLAG.bit.RESRDY = 1;
      	// start conversion again, since The first conversion after the reference is changed must not be used.
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->SWTRIG.bit.START = 1;
      
      	// waiting for conversion to complete
      	while (!ADC->INTFLAG.bit.RESRDY);
      	const uint32_t valueRead = ADC->RESULT.reg;
      
      	// disable ADC
      	while (ADC->STATUS.bit.SYNCBUSY);
      	ADC->CTRLA.bit.ENABLE = 0x00;
      
      	return valueRead * 4;
              #endif
      }
      
      posted in Hardware
      Karl-Heinz K
      Karl-Heinz K
    • How to add support for SAM D51/Cortex M4?

      Hello,
      my name is Karl-Heinz and I discovered MySensor a few days ago. I am very impressed and would like to use it for all my sensors.
      I have 8bit and 32bit MCUs.
      My latest MCU is an SAM D51 (Adafruit Itsybitsy M4).
      I can use it when I make a minor modification to MySensors/hal/architecture/SAMD/MyHwSAMD.cpp.
      When I try to compile Arduino IDE throws an error, that ADC is not defined in this context -> uint16_t hwCPUVoltage()
      I have not much experience with programming. Therefore I commented all code lines in uint16_t hwCPUVoltage() and added hardcoded "return 3.3;"
      Then I can compile at least what I tested so far for the SAM D51.

      Of course this is not a solution. Therefore I would like to ask what is the proper way to modify MySensors for use with the Cortex M4 processors.

      Thanks a lot and keep the good work going!!

      Sincerely

      Karl-Heinz

      posted in Hardware
      Karl-Heinz K
      Karl-Heinz K