Activity Forums Questions & Troubleshooting controllino maxi SPI problem

  • controllino maxi SPI problem

  • Mou-Kros

    April 7, 2022 at 2:32 pm


    I connected the NRF24L01 with the controllino maxi power to receive the radio signal from another microcontroller

    The problem is that the code does not work, although I did not encounter this problem when using the Arduino mega

    I have connected the pin of NRF24L01 to controllino like this :

    MOSI ——– MOSI

    MISO ——— MISO



    GND —- GND

    3.3V —–VCC

    Here is the code :

    #include <SPI.h>

    #include <Controllino.h>

    #include <nRF24L01.h>

    #include <RF24.h>

    RF24 radio(7,8); // nRF24L01 (CE, CSN)

    const byte address[6] = “00001”;

    unsigned long lastReceiveTime = 0;

    unsigned long currentTime = 0;

    const int led = 2;

    const int led2 = 4; //CONTROLLINO_D4;

    struct Data_Package {

    byte button1;

    byte tSwitch1;


    Data_Package data; //Create a variable with the above structure

    void setup() {

    // put your setup code here, to run once:



    pinMode(led, OUTPUT);

    pinMode(led2, OUTPUT);

    radio.openReadingPipe(0, address);




    radio.startListening(); // Set the module as receiver



    void loop() {

    // Check whether there is data to be received

    if (radio.available()) {, sizeof(Data_Package)); // Read the whole data and store it into the ‘data’ structure

    lastReceiveTime = millis(); // At this moment we have received the data


    // Check whether we keep receving data, or we have a connection between the two modules

    currentTime = millis();

    if ( currentTime – lastReceiveTime > 1000 ) { // If current time is more then 1 second since we have recived the last data, that means we have lost connection

    resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for example if a drone has a throttle up and we lose connection, it can keep flying unless we reset the values


    if (data.button1 == HIGH) {

    digitalWrite(led, HIGH);

    digitalWrite(led2, HIGH);


    else {

    digitalWrite(led, LOW);

    digitalWrite(led2, LOW);




    void resetData() {

    // Reset the values when there is no radio connection – Set initial default values

    data.button1 = 1;


  • Lukas

    May 5, 2022 at 12:50 pm

    Please see FAQ#7

    You should call Controllino_RTC_init(); before you use SPI for external device.


  • RoydL

    September 12, 2023 at 11:51 pm

    Hello Mou-Kros and Lukas,

    I do have the same issue as Mou-Kros had. The nRF24L01 works with an Arduino Uno, but as soon as it’s connected to the SPI of the Controllino maxi I don’t get any response. Did you get it to work after some changes? And if so, where in the program did you add the Controllino_RTC_init();?

    I tried several positions, but till now I could not get the right values in my serial monitor.

    Kind regards,


Viewing 1 - 3 of 3 replies

Log in to reply.

Original Post
0 of 0 posts June 2018