[SOLVED] How to use SPI2 in blue pill for the ili9341?

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Post Reply
ipsilondev
Posts: 10
Joined: Sun Aug 13, 2017 7:57 pm

[SOLVED] How to use SPI2 in blue pill for the ili9341?

Post by ipsilondev » Sun Aug 13, 2017 8:08 pm

Hi everyone ! first post here :)

recently i purchased a blue pill for a project. i'm trying to plug in an SD on SPI1 and a 2.2 lcd ili9341 on SPI2.

Now, SPI lib uses always SPI one, but on the library, if you specify 2 on the constructor of SPI, you can use the second SPI (here is the line that instance the object: https://github.com/rogerclarkmelbourne/ ... I.cpp#L776 ). So i just added

Code: Select all

SPIClass SPITWO(2)
and in the driver file of the lcd (https://github.com/rogerclarkmelbourne/ ... 41_STM.cpp) i replaced all SPI.* calls with SPITWO, but still doesn't work. unfortunately i don't have a logic analyzer right now to know if it's actually using the SPI2 pins and sending the data, so i was wondering if someone made some similar set up and how has done it, so i could use both SPI ports (i'm going to intensively use both of them).

i also changed the SPI velocity just in case (like the wiki say, SPI2 works at 18mhz, so i changed it here: https://github.com/rogerclarkmelbourne/ ... M.cpp#L107 ).

Any suggestion is welcome :) !

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: How to use SPI2 in blue pill for the ili9341?

Post by mrburnette » Sun Aug 13, 2017 11:46 pm


ipsilondev
Posts: 10
Joined: Sun Aug 13, 2017 7:57 pm

Re: How to use SPI2 in blue pill for the ili9341?

Post by ipsilondev » Mon Aug 14, 2017 12:27 am

mrburnette wrote:
Sun Aug 13, 2017 11:46 pm
Perhaps this will help:
http://www.stm32duino.com/viewtopic.php?t=278
Well, i made exactly that, the only difference, is that the driver of the lcd, doesn't use the

Code: Select all

.begin()
function, but uses

Code: Select all

.beginTransaction()
(you can see it here: https://github.com/rogerclarkmelbourne/ ... M.cpp#L181 ) and i lowered the velocity to 18mhz just in case.

looks that i will need to wait until i get my logic analyzer :cry:

ipsilondev
Posts: 10
Joined: Sun Aug 13, 2017 7:57 pm

Re: How to use SPI2 in blue pill for the ili9341?

Post by ipsilondev » Mon Aug 14, 2017 3:42 pm

Got it working ! i changed the SD to SPI2 and i discovered that a bad jumper cable was not giving vcc to the lcd :D

Thanks for reading :)

victor_pv
Posts: 1681
Joined: Mon Apr 27, 2015 12:12 pm

Re: How to use SPI2 in blue pill for the ili9341?

Post by victor_pv » Tue Aug 15, 2017 2:26 am

For anyone reaching this topic, you may want to edit the first post and add [SOLVED] in the subject.
Also to add in the solution, I believe Stevestrong was updating the ILI9341 library with the latest changes from the official Adafruit's one, and that includes the option to provide an SPI port reference, so the library can be initialized to use SPI2 (or SPITWO) or any name you want to give to any SPI port.
I do not know if Steve has sent a PR with that yet to Roger, but he probably has a working version in his repo. If you do a search for ILI9341 in the forum you may find the post where he mentions it.

zmemw16
Posts: 1449
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: How to use SPI2 in blue pill for the ili9341?

Post by zmemw16 » Tue Aug 15, 2017 3:39 am

you might want to filter by adding stevestrong as the poster as well :!:
might reduce the results, well partially at least :)
stephen

User avatar
RogerClark
Posts: 7157
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: [SOLVED] How to use SPI2 in blue pill for the ili9341?

Post by RogerClark » Tue Aug 15, 2017 3:53 am

I did change the title but the OP seems to have changed it back.

If this happens again, I'll lock the topic or delete it.

Please see this discussion http://www.stm32duino.com/viewtopic.php?f=3&t=2451 on how we handle the plethora of such posts

Post Reply