ST7735 library and nRF8001

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bboyspy
 
Posts: 2
Joined: Sat Sep 06, 2014 6:07 pm

ST7735 library and nRF8001

Post by bboyspy »

Hello!

I bought the nRF8001 module and got it working perfectly on my Arduino UNO.
I also bought a 1.8 TFT (not Adafruit!, but the cheaper red pcd one) display and got this working with the ST7735 library. No problems.

Now my plan was to bring it all together and sending data to show on the TFT coming from bluetooth. But I face a problem.

When I run the code tft.initR(INITR_BLACKTAB); the bluetooth module is no longer detectable.

Here is my code:

Code: Select all

#include <SPI.h>
#include "Adafruit_BLE_UART.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>

#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RDY 2
#define ADAFRUITBLE_RST 0

Adafruit_BLE_UART uart = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);

#define TFT_CS     4
#define TFT_RST    0
#define TFT_DC     8

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

void setup(void) {
  Serial.begin(9600);
  while(!Serial); // Leonardo/Micro should wait for serial init
  Serial.println(F("Adafruit Bluefruit Low Energy nRF8001 Callback Echo demo"));
  
  uart.setRXcallback(rxCallback);
  uart.setACIcallback(aciCallback);
  uart.begin();

  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  tft.setRotation(3);

  tft.fillScreen(ST7735_BLACK);
}
So when I run this, the screen works but I can not detect the bluetooth module. When I comment that specific line, the bluetooth module is again detectable. A few times I also got the messages "Error in ACI Setup" and "Evt Cmd respone: Error. Arduino is in an while(1); loop". Am I missing something or Is there no chance of getting them both working together?

Many thanks!

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: ST7735 library and nRF8001

Post by Franklin97355 »

It looks like both items could be SPI and as such you need to make adjustments in the pins you use to control them. You might have to resort to Software SPI.

User avatar
bboyspy
 
Posts: 2
Joined: Sat Sep 06, 2014 6:07 pm

Re: ST7735 library and nRF8001

Post by bboyspy »

Alright, thanks for the tip. I Got it working with the TFT on software SPI but as mentioned in the library comments, that works a 'bit' slower.

Obviously I'm a noob, so the noob questions:

I can't get two SPI devices working (hardware SPI) at the same time on my Arduino Uno?
Even if I use the ICSP connections for one of the devices?
An Arduino Mega, would that support multiple SPI devices?

Thanks again.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: ST7735 library and nRF8001

Post by Franklin97355 »

The Mega seems to also have only one set of hardware SPI pins. If the devices follow the spec this might help but not all devices do. http://arduino.cc/en/Reference/SPI

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”