Hi Guys,
it's the first time I'm asking you for help. Please excuse my english, but my native language is german.
I have a problem with a mega1284p and an ILI9341 display.
My system:
Linux Mint 19.2 Cinnamon, kernel 4.15.0-66 generic.
FreeBASIC 1.07.1-ubuntu-4.18-x86_64
GreatCowBASIC UNIX v0_98_06
My problem:
Software SPI works.
When I use "#define ILI9341_HardwareSPI" the chip gets stuck. The display stays white and a control LED that flashes in software SPI mode remains dark.
I searched the header files "glcd.h" and "ili9341.h". In the file ili9341.h I found the following passage:
My questions:
Where is AVR defined? I did that in my test program as part of the ILI9341 definition, but without success.
Can it be that hardware SPI is not supported in the interaction mega1284p and ILI9341?
Am I doing something wrong?
Does somebody has any idea?
Thank you very much
Last edit: Anobium 2019-11-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Where is AVR defined? I did that in my test program as part of the ILI9341 definition, but without success.
AVR is a compiler constant. It is determined by the chip you have stated.
Can it be that hardware SPI is not supported in the interaction mega1284p and ILI9341?
Am I doing something wrong?
As we know the software SPI works for you. We need to valide that harware SPI works on this chip. So, rather than have me struggle to recreate you code. Please post source code. Then, we can look at the generated ASM to determine if hardware SPI exists.
Does somebody has any idea?
Yes.
Evan
Last edit: Anobium 2019-11-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
'Define ports for the ILI9341 display
#define GLCD_CS PORTD.4 'Was incorrect .This needs to be the SS slave select line
#define GLCD_RESET PORTD.5 'can be any port .. therefore, is OK
#define GLCD_DC PORTx.y 'can be any port .. therefore, is OK
#define GLCD_DO PORTB.5 'This is valid.
#define GLCD_SCK PORTB.7 'This is valid.
So, you need to resolve the CS (SS) port and move the DC port.
Hello Stan,
Thank you for your intention to help me. GLCD_SCK and GLCD_SDO are connected to PORTD.5 and PORTD.7 according to the datasheet. It corresponds to the connections in your picture. The include file ili9341.h is the current version. It's an interesting phenomenon, in hardware SPI mode the chip hangs. For the moment I give up, I have no idea anymore. Maybe the chip is broken.
Thanks Manfred
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Manfred
Your system is....My system:
Linux Mint 19.2 Cinnamon, kernel 4.15.0-66 generic.
FreeBASIC 1.07.1-ubuntu-4.18-x86_64
GreatCowBASIC UNIX v0_98_06
Groovy. I am trying mint 19.2 and have complied freebasic and used freebasic to compile great cow basic but do not know how to set up geany to use freebasic or great cow basic.
So I use win 7...and it all works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am glad it is working. If you like you can experiment with the ili9341 include......for your own entertainment only. You can send whole bytes ie 8 pixels, different colours from gcb code easy.
Also solve wrap around if co-ordinate goes off screen. I wanted to write asteroids game.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Resolved
Hi Guys,
it's the first time I'm asking you for help. Please excuse my english, but my native language is german.
I have a problem with a mega1284p and an ILI9341 display.
My system:
Linux Mint 19.2 Cinnamon, kernel 4.15.0-66 generic.
FreeBASIC 1.07.1-ubuntu-4.18-x86_64
GreatCowBASIC UNIX v0_98_06
The chip is clocked externally at 16MHz.
My problem:
Software SPI works.
When I use "#define ILI9341_HardwareSPI" the chip gets stuck. The display stays white and a control LED that flashes in software SPI mode remains dark.
I searched the header files "glcd.h" and "ili9341.h". In the file ili9341.h I found the following passage:
My questions:
Where is AVR defined? I did that in my test program as part of the ILI9341 definition, but without success.
Can it be that hardware SPI is not supported in the interaction mega1284p and ILI9341?
Am I doing something wrong?
Does somebody has any idea?
Thank you very much
Last edit: Anobium 2019-11-04
Hello Manfred,
AVR is a compiler constant. It is determined by the chip you have stated.
As we know the software SPI works for you. We need to valide that harware SPI works on this chip. So, rather than have me struggle to recreate you code. Please post source code. Then, we can look at the generated ASM to determine if hardware SPI exists.
Yes.
Evan
Last edit: Anobium 2019-11-04
Hello Anobium,
attached the source code of the test program.
Manfred,
You pin selection is incorrect. Whilst this WILL work for SW SPI. The HW SPI pinout needs to conform the datasheet.
SW SPI as you have it:
HW SPI - see page 2 of the datasheet
So, you need to resolve the CS (SS) port and move the DC port.
Something like
I cannot test etc but I think my recommendations are valid.
Ah, I thought CS can be chosen by software. That was a mistake. It is running now.
Thanks alot
I use-
For hardware spi use pins dedicated to mosi and clock. maybe you have, I have not looked at mega1284p pins.
seems you are using hardware mosi and clock https://www.google.com/url?sa=i&source=images&cd=&cad=rja&uact=8&ved=2ahUKEwiv94uKs87lAhUvzoUKHR80BQsQjRx6BAgBEAQ&url=%2Furl%3Fsa%3Di%26source%3Dimages%26cd%3D%26ved%3D%26url%3Dhttps%253A%252F%252Fwww.flickr.com%252Fphotos%252F28521811%2540N04%252F8451021610%26psig%3DAOvVaw3nAv1u3E4EXZ0lqWL42RlE%26ust%3D1572882767316590&psig=AOvVaw3nAv1u3E4EXZ0lqWL42RlE&ust=1572882767316590
Last edit: stan cartwright 2019-11-03
I can only say that the ili9341 include has been updated in latest gcb win version.
Hello Stan,
Thank you for your intention to help me. GLCD_SCK and GLCD_SDO are connected to PORTD.5 and PORTD.7 according to the datasheet. It corresponds to the connections in your picture. The include file ili9341.h is the current version. It's an interesting phenomenon, in hardware SPI mode the chip hangs. For the moment I give up, I have no idea anymore. Maybe the chip is broken.
Thanks Manfred
@Manfred
Your system is....My system:
Linux Mint 19.2 Cinnamon, kernel 4.15.0-66 generic.
FreeBASIC 1.07.1-ubuntu-4.18-x86_64
GreatCowBASIC UNIX v0_98_06
Groovy. I am trying mint 19.2 and have complied freebasic and used freebasic to compile great cow basic but do not know how to set up geany to use freebasic or great cow basic.
So I use win 7...and it all works.
Hello Stan,
Here's a link on how to configure Geany.
Works well with me so far.
http://gcbasic.sourceforge.net/Typesetter/index.php/Geany-as-IDE-for-Linux
Thanks Manfred. I had seen it https://sourceforge.net/p/gcbasic/discussion/579125/thread/2447715df2/?limit=25&page=0
Looks too complicated to me. I am a new linux user. I have only used linux on a rasperry pi because I have to.
I like mint 19.2 because it is like using win 10 but runs 10 times faster on the same pc and hdd. Dual boot grub.
I did not think cs or dc were hardware spi ports for ili9341. My error,sorry.
I also thought that only CLK and MOSI are hardware ports. But it works now.
Have a nice day.
I am glad it is working. If you like you can experiment with the ili9341 include......for your own entertainment only. You can send whole bytes ie 8 pixels, different colours from gcb code easy.
Also solve wrap around if co-ordinate goes off screen. I wanted to write asteroids game.