[SOLVED] bluepill mcufriend special

Working libraries, libraries being ported and related hardware
altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 12:57 pm

I must have something wrong somewhere. I had mcufriend_shield.h set to use special and put the special in a hidden folder to make sure it was looking for it and sure enough I got the error on compile so put it back in utility hit upload and went off to make a corned beef sandwich just to be consistent with my slight differences lol came back it had all compiled and uploaded via maple serial but nothing on screen except light grey pushed reset on bluepill still nothing reloaded lcd_id_readreg without disconnecting any wiring and got the same

Code: Select all

Read Registers on MCUFRIEND UNO shield
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 00 93 02	Manufacturer ID
reg(0x0009) 00 00 61 00 00	Status Register
reg(0x000A) 08 08	Get Power Mode
reg(0x000C) 66 66	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 FF 00 FF 00	RD_DDB SSD1963
reg(0x00B0) 00 00	RGB Interface Signal Control
reg(0x00B4) 00 00	Inversion Control
reg(0x00B6) 00 00 00 00 00	Display Control
reg(0x00B7) 00 00	Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00	ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00	Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA
reg(0x00CC) 00 00	Panel Control
reg(0x00D0) 40 40 01	Power Control
reg(0x00D2) 40 40 01 40 40	NVM Read
reg(0x00D3) 00 00 93 02	ILI9341, ILI9488
reg(0x00D4) 41 41 01 41	Novatek ID
reg(0x00DA) 00 00	RDID1
reg(0x00DB) 93 93	RDID2
reg(0x00DC) 02 02	RDID3
reg(0x00E0) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA-N
reg(0x00EF) 00 00 00 00 00 00	ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00	Adjust Control 2
reg(0x00F6) 00 00 00 00	Interface Control
I now believe that the special is ok because yours is same as mine except you used AMASK and BMASK in #define read_8() where I used (3<<8) and (0x03F<<10) which equate to same value. But I can't see any alternative uses for the pins I am using that could interfere so not sure what the problem is now. I would just use working code and wiring if I could but one of my projects needs me to read voltage drop on two resistors for current and voltage on in and out so I can calculate watts and display on screen so that's 4 analog for a start then I need spi to communicate with an analog devices dds chip so that's why I am being so awkward and not using gods invented good wiring lol
I thought I had done quite well for a totally self taught programmer but without your help I was almost at wits end ... still close it must be something simple, but what? Wiring is ok, mcufriend_shield.h has include mcufriend_special.h, the special is as posted above, ahh! is it? thats why! let me check, did I change back gpioa to gpiob lol .... Noooooooooooooooooo lets hope that's it. I got so excited when you admited to being human I forgot to correct it . Its correct now will update very soon just grab my 5th coffee of the day! Thats how I managed to get so far Caffine and blood pressure tabs the cocodamol help a lot too! See I am very naughty too!
Last edited by altEnergy on Sun Oct 07, 2018 3:14 pm, edited 2 times in total.

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 1:11 pm

All these pills the blue one is getting me down, uploaded with corrected special not changed any wiring since getting the lcd_ID_readreg output correct again i'll burnout the memory at this rate ... 100,000 writes naa should be fine for a while yet. More like my own brain that will burn out. Its driving me a bit crazy again.
Andy

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 1:37 pm

I can not think what to try next may be a serial upload on pins PA9 and PA10 incase boatloader is messing it up although the readreg works fine on usb without even unplugging screen but I will try it. What are the pin_shield_1.h and pin_shield_8.h files are they used in my compile? do you have and ideas what else i can do as a process of elimination?

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 1:53 pm

The reason I could understand some of the direct port manipulation is I bought 10 mega 88p's about two years ago and had some code to run a dds as frequency gen that would not fit and was also a bit slow on 328p so I learned how to squeeze it down and make it run faster using direct port manipulation so made my own boards and programmed them, but forgot most of what I learned but it comes back easier than first learning.

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 2:32 pm

Well its running the code to print the serial monitor

Code: Select all

Serial took 5000ms to start
ID = 0x0
I uncomented force id and changed to this=

Code: Select all

ID = 0x9302;                             // force ID
but no change , am lost

david.prentice
Posts: 163
Joined: Wed Nov 16, 2016 8:52 am

Re: bluepill mcufriend special

Post by david.prentice » Sun Oct 07, 2018 3:24 pm

You have chosen PA8-PA9, PB10-PB15 for the data bus. I do not see any obvious problems with any of those port pins.
You are using PA0-PA4 for the control pins. They seem fine too.

You have verified the actual wiring. So that should be ok.

The "BLUEPILL ADAPTER" uses PA0-PA7 for data, PB0, PB6-PB9 for control.
The "NUCLEO64" uses PA9,PC7,PA10,PB3,PB5,PB4,PB10,PA8 for data, PA0,PA1,PA4,PB0,PC1 for control.
The "MAPLE_REV3" uses PA10,PB7,PA0,PA1,PB5,PB6,PA8,PA9 for data, PC0-PC4 for control.

The "MY_BLUEPILL" SPECIAL uses PA0-PA3,PA9,PA10,PB6,PB7 for data, PA5-PA7,PB0-PB1 for control.

I have written several other SPECIALS for people over the years. Using different combinations of port pins. I even have a 8080-16 driver.

I can only suggest that you run LCD_ID_readreg again to confirm wiring. Then run graphictest_kbv sketch without disturbing your wires.

What ID is reported on the Serial Terminal ?
What happens if you force ID = 0x 9302 ?
What happens if you run the BluePill at 24MHz or 16MHz ?

David.

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 3:39 pm

nothing is being reported on terminal for ID
and the force 9302 made no diference so I just need to figure how to change clock to 24 or 16 mega hertz could only be timing may be those pins run faster but I doubt it, its last thing I can try I have tried everything else you said multiple times to no avail! thanks for all your help David.
Andy

david.prentice
Posts: 163
Joined: Wed Nov 16, 2016 8:52 am

Re: bluepill mcufriend special

Post by david.prentice » Sun Oct 07, 2018 7:29 pm

I thought that I should double-check the first defines in your original post. I hope that is what you are currently using in the successful LCD_ID_readreg sketch.

I had misread your mapping e.g. thinking your DB0 was in PA8 and DB7 in PB15 like Uno shield mapping

On further study, DB0 maps to PB10 and DB7 maps to PA9. So my "shifts" were completely wrong e.g. should be 2,10 not 8,8

Code: Select all

// configure macros for the data pins
#define AMASK 0x0300
#define BMASK 0xFC00
#define write_8(d)    { GPIOA->REGS(BSRR) = AMASK << 16; GPIOB->REGS(BSRR) = BMASK << 16; \
                       GPIOA->REGS(BSRR) = (((d) & 0x3F) << 10); \
                       GPIOB->REGS(BSRR) = (((d) & 0xC0) << 2); \
                       }
#define read_8()      (((GPIOA->REGS(IDR) & AMASK) >> 2) | ((GPIOB->REGS(IDR) & BMASK) >> 10))
David.

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 8:24 pm

Oh Thank you so much David not because i have tried it, that will come in next 15 minute but because you went the extra mile, I was never to sure what i was shifting where, so in a way i misled you.Being as I have tried everything except changing frequency, and had fun reading about rogers radio experiments whilst searching for ways to change frequency , my bet is this will be solved in a few minutes again can't thank you enough, even if that does not fix it but I feel very sure it will, being as I can get a display from a bluepill that cant even read id correctly and this one matches mega everytime! back soon!
Andy

altEnergy
Posts: 37
Joined: Thu Oct 04, 2018 9:59 am

Re: bluepill mcufriend special

Post by altEnergy » Sun Oct 07, 2018 8:56 pm

oh dear I uploaded it didn't work so changed the force id back as it was, Just in case that had some effect on sketch locking up , still no joy so loaded the lcd_id_readreg sketch everything still perfect there and have not touched wiring throughout, I need an exorcist on this one, I mean each of the first two bluepills are behaving very strange one more so than the other. This one is acting like its ok till I run a graphicstest_kbv sketch.
Sorry to be bearer of more bad news.
Andy

Post Reply