Remap PB2

Post here first, or if you can't find a relevant section!
User avatar
efftek
Posts: 45
Joined: Tue Jan 10, 2017 9:42 pm
Location: UK / Cyprus
Contact:

Re: Remap PB2

Postby efftek » Fri Feb 24, 2017 10:35 am

Genious!

It was so much easier to move all the pins across to PB5..PB9 and redefine in the sketch and you, I get sensible results

No to edit the hearer file and try the graphics test .... I may be some time

Code: Select all

Read Registers on STM32duino
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 54 80 66   Manufacturer ID
reg(0x0009) 00 00 61 00 00   Status Register
reg(0x000A) 00 08   Get Powsr Mode
reg(0x000C) 00 06   Get Pixel Format
reg(0x0061) 00 00   RDID1 HX8347-G
reg(0x0062) 00 00   RDID2 HX8347-G
reg(0x0063) 00 00   RDID3 HX8347-G
reg(0x0064) 00 00   RDID1 HX8347-A
reg(0x0065) 00 00   RDID2 HX8347-A
reg(0x0066) 00 00   RDID3 HX8347-A
reg(0x0067) 00 00   RDID Himax HX8347-A
reg(0x0070) 00 00   Panel Himax HX8347-A
reg(0x00A1) 00 93 30 93 30   RD_DDB SSD1963
reg(0x00B0) 00 00   RGB Interface Signal Control
reg(0x00B4) 00 02   Inversion Control
reg(0x00B6) 00 02 02 3B 3B   Display Control
reg(0x00B7) 00 06   Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00   ILI9481, HX8357-B
reg(0x00C0) 00 0E 0E 0E 0E 0E 0E 0E 0E   Panel Control
reg(0x00C8) 00 B0 B0 B0 B0 B0 B0 B0 B0 B0 B0 B0 B0   GAMMA
reg(0x00CC) 00 03   Panel Control
reg(0x00D0) 00 00 00   Power Control
reg(0x00D2) 00 00 00 00 04   NVM Read
reg(0x00D3) 00 00 94 88   ILI9341, ILI9488
reg(0x00DA) 00 54   RDID1
reg(0x00DB) 00 80   RDID2
reg(0x00DC) 00 66   RDID3
reg(0x00E0) 00 00 07 0C 05 13 09 36 AA 46 09 10 0D 1A 1E 0F   GAMMA-P
reg(0x00E1) 00 00 20 23 04 10 06 37 56 49 04 0C 0A 33 37 0F   GAMMA-N
reg(0x00EF) 00 00 00 00 00 00   ILI9327
reg(0x00F2) 00 58 04 12 02 22 22 FF 0A 90 14 88   Adjust Control 2
reg(0x00F6) 00 00 00 00   Interface Control

User avatar
efftek
Posts: 45
Joined: Tue Jan 10, 2017 9:42 pm
Location: UK / Cyprus
Contact:

Re: Remap PB2

Postby efftek » Fri Feb 24, 2017 8:08 pm

SteveStrong

It still no workee! It reports the following;

Code: Select all

TFT LCD test
TFT size is 240x320
ID: 0

*** Unknown LCD driver chip: 0


So, I was looking at Adafruit_TFTLCD_8bit_STM32.cpp and I wondered about two functions

Code: Select all

uint16_t Adafruit_TFTLCD_8bit_STM32::readID(void)
{
   if (readReg32(0x04) == 0x8000) { // eh close enough
    // setc!
    writeRegister24(HX8357D_SETC, 0xFF8357);
    delay(300);
    //Serial.println(readReg(0xD0), HEX);
    if (readReg32(0xD0) == 0x990000) {
      return 0x8357;
    }
  }

  uint16_t id = readReg32(0xD3);
  //Serial.print("ID: "); Serial.println(id,HEX);

  if (id != 0x9341) {
    id = readReg(0);
  }
  //Serial.print("ID: "); Serial.println(id,HEX);
  return id;
}


looks like it will only return 0x9341 OR 0 - mine is 0x9488 which I understand will work with a 9341 driver, it just has additional functions which obviously cant be made use of but when I uncomment the line Serial.print("ID: "); Serial.println(id,HEX); to see what the ID is, I get a 0 anyway.

BUT, that could all be explained by the following function

Code: Select all

Adafruit_TFTLCD_8bit_STM32 :: Adafruit_TFTLCD_8bit_STM32(void)
: Adafruit_GFX(TFTWIDTH, TFTHEIGHT)
{
  //Set command lines as output
  //Note: CRH and CRL are both 32 bits wide
  //Each pin is represented by 4 bits 0x3 (hex) sets that pin to O/P
  TFT_CNTRL->regs->CRL = (TFT_CNTRL->regs->CRL & 0xFFFF0000) | 0x00003333;
    CS_IDLE; // Set all control bits to HIGH (idle)
    CD_DATA; // Signals are ACTIVE LOW
    WR_IDLE;
    RD_IDLE;
/**/
  //reset();
  //set up 8 bit parallel port to write mode.
  setWriteDir();
}


So, as Ive swapped the TFT_CTRL to PORTB and moved the control lines from A0..A5 to B5..B9, maybe this needs to be rewritten as B5..B7 are on CRL and B8 & B9, CRH

Would this be correct?

Code: Select all

Adafruit_TFTLCD_8bit_STM32 :: Adafruit_TFTLCD_8bit_STM32(void)
: Adafruit_GFX(TFTWIDTH, TFTHEIGHT)
{
  //Set command lines as output
  //Note: CRH and CRL are both 32 bits wide
  //Each pin is represented by 4 bits 0x3 (hex) sets that pin to O/P
  TFT_CNTRL->regs->CRL = (TFT_CNTRL->regs->CRL & 0x000FFFFF) | 0x33300000;
    CS_IDLE; // Set all control bits to HIGH (idle)
    CD_DATA; // Signals are ACTIVE LOW
    WR_IDLE;
    RD_IDLE;
    TFT_CNTRL->regs->CRH = (TFT_CNTRL->regs->CRH & 0xFFFFFF00) | 0x00000033;
    CS_IDLE; // Set all control bits to HIGH (idle)
    CD_DATA; // Signals are ACTIVE LOW
    WR_IDLE;
    RD_IDLE;
/**/
  //reset();
  //set up 8 bit parallel port to write mode.
  setWriteDir();
}


If not, please dont ridicule me, I'm just trying to apply my logic to the situation and I stand to learn from my mistakes.

Also, I took both ili9341cpp and ili9341.f files, copied them to ili9488.xxx and replaced every instance of 9431 with 9488 inside them and added #include ili9488.h in the Adafruit_TFTLCD_8bit_STM32.cpp file as a starting point to include ili9488 in the library. Is that the correct course of action?

Thanks again, Steve F.

stevestrong
Posts: 724
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Remap PB2

Postby stevestrong » Fri Feb 24, 2017 11:02 pm

All that looks right, but ILI9341 was not tested, i only had ILI9328 to test so far, so it may happen that more will fail and has to be debugged...
I am actually glad if someone has time to add value to the lib.

stevestrong
Posts: 724
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Remap PB2

Postby stevestrong » Sun Feb 26, 2017 6:44 am

Meanwhile I updated my repo to support an ILI9341-like display controller, so the ILI9341-related files has also been changed.
You could collect info about your display controller in David Prentice's repo (mcufriends_kbv) and add in to my one, in order to work with original Adafruit functions and GFX lib.
EDIT
You can see here the resulted graphicstest benchmark.

User avatar
efftek
Posts: 45
Joined: Tue Jan 10, 2017 9:42 pm
Location: UK / Cyprus
Contact:

Re: Remap PB2

Postby efftek » Sun Feb 26, 2017 8:32 pm

Downloaded latest repo. Cheers.

Am going home Wednesday morning and probably won't get time to do anything more until im back in UK two weeks later as Bev probably has a list of jobs for me!

Steve F.


Return to “General discussion”

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 3 guests