trilu2000 / NewAskSin

working version of new AskSin framework, which should be more structured then the old one
28 stars 15 forks source link

I2C Problem using NewAskSin-Lib + Adafruit_SSD1306-Lib ? #28

Closed broxinagil closed 5 years ago

broxinagil commented 7 years ago

I'm just trying to combine my Arduino to use NewAskSin and OLED-128x64 Display simultaneously on a raduino CC1101. The example Sketch HM_LC_SW1_BA_PCB2 ist working, as well the OLED-Display if I use them each in separate Sketches. If I add some Output in the "void loop" (just after hm.poll()), either the Display or receiving RF won't work. Anyhow, if I do not remark "power_all_disable", the Display won't show nothing. If i leave that, OLED displays data, but no RF is received anymore.

what I have added in HM_LC_SW1_BA_PCB2:

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

int mycnt = 0;

#define OLED_RESET 4
Adafruit_SSD1306 oled(OLED_RESET);

void setup() {
    // init OLED
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);  
  oled.display();
  oled.clearDisplay();
  oled.display();

  oled.setTextColor(WHITE);
  oled.setTextSize(1);
....
}

void loop() {
    // - AskSin related ---------------------------------------
    hm.poll();              // poll the homematic main loop

        mycnt = (mycnt + 1) % 10;
        oled.clearDisplay();
        oled.setCuror(1,0);
        oled.print(mycnt);
        oled.display();
}

Has anybody an Idea what's going wrong here ?

Regards, Boris

trilu2000 commented 7 years ago

Hi Boris, i'am pretty sure that the problem is the chip select of the spi port. the cc1101 communication modul needs a chip select as well as the oled display. i cannot see in your example that the oled uses a different pin, while not configured... best regards Horst

broxinagil commented 7 years ago

Maybe I'm wrong on SPI, as the OLED is connected only to SDA+SCL (and VCC+GND ofc). Therefore there is no CS. Address seems to be 0x3C as seen in oled.begin. I'm also not aware of the internal wiring of the radino CC1101. You may take a look into http://shop.in-circuit.de/product_info.php?cPath=22_27&products_id=32

edit: Here's a Quote from the given site

Zur Kommunikation mit dem internen Funkteil werden bei allen radino Modulen die selben Arduino-Pins belegt: IO8,IO9,D4,D7,A4. Alle anderen Pins sind frei programmierbar