0

Driving 2X RA8875 off of one microcontroller, can it be done
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Driving 2X RA8875 off of one microcontroller, can it be

by paulstoffregen on Sun Nov 23, 2014 11:45 pm

This RA8875 breakout board should NOT be used directly together with any other SPI device, not even a SD card.

The bitmap image example in the library should probably not be published. Or at least it should warn users to add a tri-state buffer, to prevent the RA8875 and SD card from driving MISO at the same time. The RA8875 MISO output is not very strong, so many other SPI MISO outputs can probably overpower it, but certainly doing so is not good.

There doesn't seem to be any way to get the RA8875 to tri-state its SDO signal when in 4-wire mode. This is exact the same problem as seem with the CC3000 breakout at version 1.0.

Adafruit should really consider a 1.1 version for this breakout, with the tri-state buffer chip added. Pullup resistors on CS and RST would also be a very good addition, so the display can properly ignore communication from other SPI devices before it's initialized.

paulstoffregen
 
Posts: 434
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Driving 2X RA8875 off of one microcontroller, can it be

by adafruit_support_rick on Mon Nov 24, 2014 1:17 pm

paulstoffregen wrote:Rick, that's the nRF8001 schematic.

I'm working on a RA8875 conflict today. I fixed nRF8001 a couple days ago!

D'Oh! Long day...
https://github.com/adafruit/Adafruit-RA ... -Board-PCB

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Driving 2X RA8875 off of one microcontroller, can it be

by adafruit2 on Mon Nov 24, 2014 1:20 pm

oh man that is annoying! we'll add to the product page :/

adafruit2
Site Admin
 
Posts: 18664
Joined: Fri Mar 11, 2005 7:36 pm

Re: Driving 2X RA8875 off of one microcontroller, can it be

by paulstoffregen on Tue Nov 25, 2014 10:27 am

I saw the product page has been updated with a warning about the tri-state issue. Very good.

You might also consider editing the text on that page which recommends the STMPE610. Such a pairing would only work if the STMPE610 is used in I2C mode, or soft-SPI mode, or if a tri-state buffer chip is used for the RA8875.

paulstoffregen
 
Posts: 434
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Driving 2X RA8875 off of one microcontroller, can it be

by local_dani_21 on Tue Nov 25, 2014 2:38 pm

So, to summarize: If you want to use more than one RA8875 on a single microcontroller, you need to tri-state the MISO lines going from the RA8875s to the microcontroller and add 10k pull-up resistors to all CS and RESET pins as shown in the following drawing.
Image.

Adafruit, I think it would be a good idea to make a RA8875 V1.1 including a 74HC125 – similar to the updated version of the CC3000 WiFi-board, which was - in it's original version without the 74HC125 - usable only in a very limited way.

PS: If you want to use the RA8875s with a teensy https://www.pjrc.com/teensy/ instead of an Arduino (to get more flash, RAM, speed or use less space), you need to replace adafruit's RA8875 library with the one by Paul Stoffregen https://github.com/PaulStoffregen/Adafruit_RA8875.

PPS: Adafruit: Is there a possibility that you could coordinate with Paul if maybe his changes to the RA8875 library could become part of your library so that it would work out of the box with a greater variety of microcontrollers? That would be very conventient for the customers. Thanks.

Good luck, Dani

local_dani_21
 
Posts: 126
Joined: Sun Apr 19, 2009 3:10 pm
Location: Zürich, Switzerland

Re: Driving 2X RA8875 off of one microcontroller, can it be

by paulstoffregen on Tue Nov 25, 2014 5:08 pm

local_dani_21 wrote:PPS: Adafruit: Is there a possibility that you could coordinate with Paul if maybe his changes to the RA8875 library could become part of your library so that it would work out of the box with a greater variety of microcontrollers?


My copy is simply an older version.

I'm pretty sure this recent commit broke the library on Teensy 3.1.

https://github.com/adafruit/Adafruit_RA ... 8c48bdd5ba

This change basically leaves the SPI port unconfigured for non-AVR chips. Not good. Why it works on Arduino Due, I do not know, but it's certainly far from a software "best practice".

Eventually, I'll add SPI transaction support for this library. The new transaction functions eliminate the need for board and clock specific dividers.

paulstoffregen
 
Posts: 434
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Driving 2X RA8875 off of one microcontroller, can it be

by adafruit_support_rick on Tue Nov 25, 2014 6:03 pm

wow - I did that. I don't know what I was thinking, but I clearly didn't know what I was doing. I'll have to fix that.

So, it works on the Teensy with the conditionals removed?

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Driving 2X RA8875 off of one microcontroller, can it be

by paulstoffregen on Tue Nov 25, 2014 6:09 pm

I moved the RA8875s off my bench. I'm working on another project at this moment. I just don't have this stuff hooked up at the moment to verify.

That 3rd RA8875 arrived last night. I'll take a look again in a few days. At the moment, no (known) customer is suffering, so this moves to a lower priority for me.

Long-term, I want to see this and all libraries using SPI move to the transaction functions. They work much better, and they do not depend on board and clock settings, so these sorts of hacks should not be needed in the future.

paulstoffregen
 
Posts: 434
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Driving 2X RA8875 off of one microcontroller, can it be

by local_dani_21 on Tue Nov 25, 2014 6:35 pm

Well, I just attached a third RA8875 with a 5" TFT attached (CS to pin 6, RST to pin 5, SCK, MOSI directly to the microcontroller, MISO via 74HC125). I used the following code to test the setup with a teensy 3.1. The first two displays start up normally - the third one eventally (after a few seconds) brings the system down somehow (see movie). After that black out, the system doesn't react to a reset push nor is it possible to re-upload a sketch. The teensy has to be powered off for a few seconds to work again.

I tried this with a MacBook Pro USB connection and with a USB wall powered adaptor (1200mA @ 5V) because it looked like a power undersupply to me, the results are however the same.

Do you have any idea how I could investigate what is happening?
Regards, Dani

Movie: http://www.wunderwald.ch/pics/IMG_4047.MOV

Code: Select all | TOGGLE FULL SIZE
/******************************************************************
 This is an example for the Adafruit RA8875 Driver board for TFT displays
 ---------------> http://www.adafruit.com/products/1590
 The RA8875 is a TFT driver for up to 800x480 dotclock'd displays
 It is tested to work with displays in the Adafruit shop. Other displays
 may need timing adjustments and are not guanteed to work.
 
 Adafruit invests time and resources providing this open
 source code, please support Adafruit and open-source hardware
 by purchasing products from Adafruit!
 
 Written by Limor Fried/Ladyada for Adafruit Industries.
 BSD license, check license.txt for more information.
 All text above must be included in any redistribution.
 ******************************************************************/

#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_RA8875.h"

// Library only supports hardware SPI at this time
// Connect SCLK to T31 Digital #13 (Hardware SPI clock)
// Connect MISO to T31 Digital #12 (Hardware SPI MISO)
// Connect MOSI to T31 Digital #11 (Hardware SPI MOSI)

#define RA8875_CS 10
#define RA8875_RESET 9
#define RA8875_CS_2 8
#define RA8875_RESET_2 7
#define RA8875_CS_3 6
#define RA8875_RESET_3 5

Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);
Adafruit_RA8875 tft2 = Adafruit_RA8875(RA8875_CS_2, RA8875_RESET_2);
Adafruit_RA8875 tft3 = Adafruit_RA8875(RA8875_CS_3, RA8875_RESET_3);
uint16_t tx, ty;



void setup()
{
  Serial.begin(57600);
  while(!Serial){}
  Serial.println("RA8875 start");
  /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
  if (!tft.begin(RA8875_800x480)) {
    Serial.println("RA8875 Not Found!");
    while (1);
  }
  Serial.println("Found RA8875");

  Serial.println("RA8875 2 start");
  /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
  if (!tft2.begin(RA8875_800x480)) {
    Serial.println("RA8875 2 Not Found!");
    while (1);
  }
  Serial.println("Found RA8875 2");

  Serial.println("RA8875 3 start");
  /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
  if (!tft3.begin(RA8875_800x480)) {
    Serial.println("RA8875 3 Not Found!");
    while (1);
  }
  Serial.println("Found RA8875 3");

  tftSetup(&tft);
  tftSetup(&tft2);
  tftSetup(&tft3);
  }

void loop()
{}

void tftSetup(Adafruit_RA8875 *tft)
{
  tft->displayOn(true);
  tft->GPIOX(true);      // Enable TFT - display enable tied to GPIOX
  tft->PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
  tft->PWM1out(255);

  // With hardware accelleration this is instant
  tft->fillScreen(RA8875_WHITE);

  // Play with PWM
  for (uint8_t i=255; i!=0; i-=5 )
  {
    tft->PWM1out(i);
    delay(10);
  } 
  for (uint8_t i=0; i!=255; i+=5 )
  {
    tft->PWM1out(i);
    delay(10);
  }
  tft->PWM1out(255);
 
  tft->fillScreen(RA8875_RED);
  delay(500);
  tft->fillScreen(RA8875_YELLOW);
  delay(500);
  tft->fillScreen(RA8875_GREEN);
  delay(500);
  tft->fillScreen(RA8875_CYAN);
  delay(500);
  tft->fillScreen(RA8875_MAGENTA);
  delay(500);
  tft->fillScreen(RA8875_BLACK);
 
  // Try some GFX acceleration!
  tft->drawCircle(100, 100, 50, RA8875_BLACK);
  tft->fillCircle(100, 100, 49, RA8875_GREEN);
 
  tft->fillRect(11, 11, 398, 198, RA8875_BLUE);
  tft->drawRect(10, 10, 400, 200, RA8875_GREEN);
  tft->fillRoundRect(200, 10, 200, 100, 10, RA8875_RED);
  tft->drawPixel(10,10,RA8875_BLACK);
  tft->drawPixel(11,11,RA8875_BLACK);
  tft->drawLine(10, 10, 200, 100, RA8875_RED);
  tft->drawTriangle(200, 15, 250, 100, 150, 125, RA8875_BLACK);
  tft->fillTriangle(200, 16, 249, 99, 151, 124, RA8875_YELLOW);
  tft->drawEllipse(300, 100, 100, 40, RA8875_BLACK);
  tft->fillEllipse(300, 100, 98, 38, RA8875_GREEN);
  // Argument 5 (curvePart) is a 2-bit value to control each corner (select 0, 1, 2, or 3)
  tft->drawCurve(50, 100, 80, 40, 2, RA8875_BLACK); 
  tft->fillCurve(50, 100, 78, 38, 2, RA8875_WHITE);

}

local_dani_21
 
Posts: 126
Joined: Sun Apr 19, 2009 3:10 pm
Location: Zürich, Switzerland

Re: Driving 2X RA8875 off of one microcontroller, can it be

by local_dani_21 on Tue Nov 25, 2014 6:45 pm

It seems to be a power thing - when I connect power not through micro-usb of the teensy but directly to the breadboard and from there to GND and VIN of the teensy, the sketch keeps running! Is there a limitation of teensy 3.1 bringing current through from USB to the VIN-pin, where I usually get the 5V from?

local_dani_21
 
Posts: 126
Joined: Sun Apr 19, 2009 3:10 pm
Location: Zürich, Switzerland

Re: Driving 2X RA8875 off of one microcontroller, can it be

by paulstoffregen on Tue Nov 25, 2014 6:49 pm

I'd suggest measuring the voltage. There is a 500 mA PTC, but other factors like the resistance in the wires of the USB cable can also factor in. You can learn far more with some voltage measurements than I can offer with blind guessing.


ps: the resistor color widget on every single post is getting old. Let's continue this on the PJRC forum.

paulstoffregen
 
Posts: 434
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Driving 2X RA8875 off of one microcontroller, can it be

by brian49 on Tue Jan 20, 2015 7:07 pm

On the RA8875 spi serial data out not tristate issue, had the issue been reported to RAIO Technologies? They need to fix this to the chips, at least on the next production run.

Regards,
Brian

brian49
 
Posts: 61
Joined: Tue Oct 14, 2014 6:08 pm

Re: Driving 2X RA8875 off of one microcontroller, can it be

by paulstoffregen on Tue Jan 20, 2015 7:10 pm

brian49 wrote:had the issue been reported to RAIO Technologies?


I have not done so. Please feel free to take this on. You're welcome to copy anything I've written on this thread, or the related thread on forum.pjrc.com.

paulstoffregen
 
Posts: 434
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Driving 2X RA8875 off of one microcontroller, can it be

by brian49 on Tue Jan 20, 2015 7:54 pm

I just sent them an email. They need to disclose this issue on the datasheet and fix it. It's a major bug. The datasheet v19, Fig 6-12 and 6-18 both show 3-wire and 4-wire SPI Timing with serial data out tri-state when chip select is high. Will see what they say.

brian49
 
Posts: 61
Joined: Tue Oct 14, 2014 6:08 pm

Re: Driving 2X RA8875 off of one microcontroller, can it be

by brian49 on Wed Jan 21, 2015 3:12 pm

Here is RAIO reply, and the recommanded circuit is adding the external same tristate buffer. I did ask them to update the datasheet to point out the anomaly.

Brian




Hi Brian,
Yes, the SDO is not a tri-state structure when chip select SCS# is high. If you want to use the multi SPI device application, please refer to the recommended circuit as the attached file. Thanks.

Best Regards,


古敬愷(Ching-Kai Ku)
IC應用部/產品研發處(IC Application Dept./Product Development Div.)
瑞佑科技股份有限公司(RAIO TECHNOLOGY INC.)
30288新竹縣竹北市台元一街8號6樓之5 (台元科技園區)
6F-5, No.8, Tai Yuen 1st Street, Chupei City, Hsinchu, Taiwan 30288
TEL: 886-3-563-7888 ext.508 FAX: 886-3-560-1166
Website: www.raio.com.tw

brian49
 
Posts: 61
Joined: Tue Oct 14, 2014 6:08 pm

Please be positive and constructive with your questions and comments.