Odroid c1 as getaway?



  • I'm asking myself if it would be possible to use an odroid c1 (I have a spare one) as a getaway with direct connection to a NRF24L01+ (like raspberry or orange do)

    I think odroid c1 is quite compatible with raspberry gpios (wirepi works in it for example). I'm not expecting to work without modifications, but maybe someone has tried it yet and could save me some time.

    Have anyone tested it? Any advise to take in mind?



  • OK. I'm making small progress. Nothing amazing but I have not yet my nrf24. I'm using as base the orange pi zero getaway howto.
    As I can see spidev is now supported in mysensors so i did this untill now.

           $ modprobe spicc
           $ modprobe spidev
    
           # gpio-admin export 100 
           # gpio-admin export 101 
    
    • Configure Mysensors to use spidev and gpios 100 and 101 with
           # ./configure --spi-spidev-device=/dev/spidev0.0 \
            --my-transport=nrf24 --my-rf24-ce-pin=100 --my-rf24-cs-pin=101
    
    • Build Mysensors with make and test that the communication fails with the nrf24 module (obbious, there is no nrf24 module 😊 )
           # make
           # sudo ./bin/mysgw -d
           mysgw: Starting gateway...
           mysgw: Protocol version - 2.2.0-beta
           mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.2.0-beta
           mysgw: TSM:INIT
           mysgw: TSF:WUR:MS=0
           mysgw: !TSM:INIT:TSP FAIL
           mysgw: TSM:FAIL:CNT=1
           mysgw: TSM:FAIL:PDT
    

    And that's all until my module arrives



  • @marceloaqno , as you are who made the orange pi how-to, and the code adaptation for spidev, maybe you can tell me if I'm on the right way


  • Code Contributor

    @dantefff Nice. Let me know when your module arrives, and you start testing with it.



  • @marceloaqno As expected, once receibed my nrf24, this does not work 😞
    Any options to debug this in an easy way?
    The nrf24 is working in a rpi1 so nrf24 is ok.



  • @dantefff are you sure the pin numbers are correct? can you connect a LED and test if it's the right numbers?



  • @pansen Sure! What should I connect? If I connect leds to the spi pins should they blink? And what about the cs and ce pins?



  • Yes, an LED with a resistor. Then try to turn it on and off. But maybe that is not even necessary.

    Besides, the pin numbers you mentioned seem quite odd, but I do not have experience with the C1.
    Considering this image", your nrf24 has to be connected to header pins 19,21,23,1 for MOSI,MISO,SCK,3V3 and any GND one. Since you connected the two remaining ones on 100 and 101, try first to modify your configure to

    ./configure --spi-spidev-device=/dev/spidev0.0 \
            --my-transport=nrf24 --my-rf24-ce-pin=22 --my-rf24-cs-pin=21
    

    Which are the WiringPi pin numbers.

    let me know if it works.



  • But 100 and 101 are export numbers. Does Mysensors use WiringPi numbers or Export numbers?



  • I don't know. Looked at the code, these are my conclusions:

    RF24.cpp

    LOCAL void RF24_csn(const bool level)
    {
    	hwDigitalWrite(MY_RF24_CS_PIN, level);
    }
    
    LOCAL void RF24_ce(const bool level)
    {
    	hwDigitalWrite(MY_RF24_CE_PIN, level);
    }
    

    MY_RF24_CS_PIN and MY_RF24_CE_PIN are supposedly set by ./configure

    hwDigitalWrite leads to MyHwLinuxGeneric.cpp

    
    void hwDigitalWrite(uint8_t pin, uint8_t value)
    {
    	digitalWrite(pin, value);
    }
    

    which leads to GPIO.cpp

    void GPIO::digitalWrite(uint8_t pin, uint8_t value)
    {
    	FILE *f;
    	char file[128];
    
    	if (pin > lastPinNum) {
    		return;
    	}
    	if (0 == exportedPins[pin]) {
    		pinMode(pin, OUTPUT);
    	}
    
    	sprintf(file, "/sys/class/gpio/gpio%d/value", pin);
    	f = fopen(file, "w");
    
    	if (value == 0)	{
    		fprintf(f, "0\n");
    	} else {
    		fprintf(f, "1\n");
    	}
    
    	fclose(f);
    }
    

    As you can see, the pin numbers you chose have to coincide with the "file" mentioned here:

    sprintf(file, "/sys/class/gpio/gpio%d/value", pin);
    

    If you're not sure, the already mentioned LED test can help by switching on/off the concerned "files".



  • Ok. It was as I expected. The pin numbers are right (export number is the one I need to use). I'll try the led in a feew minutes, but I have tested to get the value of that pins and it seems they are the correct ones. Maybe the error was to not especify pullup or pulldown value on the exported pins



  • @pansen, @marceloaqno Led seems not to work in pin 100 so I changed to 115. In 115 led is lighted, but when I connect the RF24 I get the same error.
    By the way, SPI pins (MOSI, MISO and SCLK) do not light any led, is this ok?



  • Yes, SPI pins should not light. I am at the end of my knowledge here, sorry. Next step would be connecting an oscilloscope to see it anything omes out the SPI interface and the selected pins.



  • @pansen I have no oscilloscope near... Lets talk about it with Odroid community and hope someone could help me



Suggested Topics

12
Online

11.4k
Users

11.1k
Topics

112.7k
Posts