I am trying to operate two spi devices on the same data/clock lines (but different CS pins).
One device is a display using the ILI9340 GCB library. The other is an SD card.
The display will not initialize with the SD card inserted. It seems like the GLCD goes into some kind of initialization routine after the #define lines before the SD CS can be disabled.
The SD card can be inserted after initialization and everything on the display seems to work.
Writing to the SD card however does not happen.
Any ideas?
I could use the secondary SPI pins for the second device I suspose, but it would mean more wiring.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The ST7735 GLCD works with the SD Card I have here. I can check out the ILI9340 driver later,if needed.
What SD Card driver are you using? I have not release the one I have on development here but it does work with the ST7735 but the initialisation was not the simpliest.
What version of Great Cow Basic compiler are you using? We did fix some core issues to support the SD Card I have in development. So, you will need the latest code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using my own SD routine (which works when there are no pin conflicts).
The other problem I am having is that the display is turned on by the 16F1788. The problem is that the command to turn on the power is executed after the GLCD initialization in the compiled ASM despite being before in the basic code. So the power is turned on during intialization and the screen comes up half black half white.
Last edit: David Stephenson 2015-11-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you zip up the code? It looks like a issue with the iniitialisation process. The order of your code. I did some thinking to get the code to work as required.
I have just tested here. Notice the the SD Card does not show here, this is in the main code
I've attached the important bits of the program.
I've tested the sdwrite subroutine and it works on its own (it writes two 512 byte blocks).
I am going to try the alternate pins for spi (by setting AFPCON1) and see what happens.
Can you post a little bit of code that I can compile? I am getting batemp=baoutl(i) errors. Send me your ASM also.
I have just soldered a connection to the SD Card on my ILI9341 display. I am getting the display and the sd card responding but the code, of course, is radically different. I have shared connection with the CS on different ports.
Last edit: Anobium 2015-11-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've wired the SD to the alternate pins (portb.5,6,7). Now the display will work with the card in. Some writing to the card has happened as well (only one 512 byte block transfered instead of 2, but thats probably my coding error).
Is there any trick I need to employ with the CS lines they seem to behave strangely maybe that is where I am getting the problems.
As I understand it CS needs to be low to activate the device for SPI, and high to disable, but find I have to pull them low again or I get a current leak through the device.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anobium,
Can you post your INITSD routine? I am still not getting things to work it seems that the SPI settings for the display will not work with the SD card.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to operate two spi devices on the same data/clock lines (but different CS pins).
One device is a display using the ILI9340 GCB library. The other is an SD card.
The display will not initialize with the SD card inserted. It seems like the GLCD goes into some kind of initialization routine after the #define lines before the SD CS can be disabled.
The SD card can be inserted after initialization and everything on the display seems to work.
Writing to the SD card however does not happen.
Any ideas?
I could use the secondary SPI pins for the second device I suspose, but it would mean more wiring.
Hello,
The ST7735 GLCD works with the SD Card I have here. I can check out the ILI9340 driver later,if needed.
What SD Card driver are you using? I have not release the one I have on development here but it does work with the ST7735 but the initialisation was not the simpliest.
What version of Great Cow Basic compiler are you using? We did fix some core issues to support the SD Card I have in development. So, you will need the latest code.
I am using my own SD routine (which works when there are no pin conflicts).
The other problem I am having is that the display is turned on by the 16F1788. The problem is that the command to turn on the power is executed after the GLCD initialization in the compiled ASM despite being before in the basic code. So the power is turned on during intialization and the screen comes up half black half white.
Last edit: David Stephenson 2015-11-09
Can you zip up the code? It looks like a issue with the iniitialisation process. The order of your code. I did some thinking to get the code to work as required.
I have just tested here. Notice the the SD Card does not show here, this is in the main code
Which comes much later.
~~~~~
;InitSD
call INITSD
;Find first partition sector
;Dim PartStart As Long
;PartStart = SDFindPartition(1)
movlw 1
banksel SDPARTITION
~~~~~
I've attached the important bits of the program.
I've tested the sdwrite subroutine and it works on its own (it writes two 512 byte blocks).
I am going to try the alternate pins for spi (by setting AFPCON1) and see what happens.
Can you post a little bit of code that I can compile? I am getting batemp=baoutl(i) errors. Send me your ASM also.
I have just soldered a connection to the SD Card on my ILI9341 display. I am getting the display and the sd card responding but the code, of course, is radically different. I have shared connection with the CS on different ports.
Last edit: Anobium 2015-11-09
I've wired the SD to the alternate pins (portb.5,6,7). Now the display will work with the card in. Some writing to the card has happened as well (only one 512 byte block transfered instead of 2, but thats probably my coding error).
Is there any trick I need to employ with the CS lines they seem to behave strangely maybe that is where I am getting the problems.
As I understand it CS needs to be low to activate the device for SPI, and high to disable, but find I have to pull them low again or I get a current leak through the device.
Anobium,
Can you post your INITSD routine? I am still not getting things to work it seems that the SPI settings for the display will not work with the SD card.
@David. Yes. It will be Friday evening before I can do this.