Pic32mx230 slow spi clock

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Pic32mx230 slow spi clock

Post by Alkaline »

Hello

We are trying to use a ili9341 on pic32mx230f256B
We are successfully implement the macro glcd_ili9341. The display turn on and images appear on the screen.
We have only problem, the speed. Running at a very low speed
by measuring the clock on the sck pin we get 1.1-1.2Mhz.

Did any of you find the same difficulties with spi?

In attachment the clock configuration of pic32

The system clock running at 40Mhz (checked)

Best regards
Attachments
MX230F256B_config.pdf
(233.65 KiB) Downloaded 70 times

stefan.erni
Posts: 570
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: Pic32mx230 slow spi clock

Post by stefan.erni »

Hello

Are you using a software SPI or hardware? Maybe you can post a printscreen from the SPI config.


regards

Stefan

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi Stefan

Thanks for reply.

We don't call directly spi interface, we use the pin configuration in glcd_ili9341 .

In attachment the program

Best Regards
Attachments
Flowcode8_display_ILI9341.pdf
(264.51 KiB) Downloaded 88 times

User avatar
Benj
Matrix Staff
Posts: 14851
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Pic32mx230 slow spi clock

Post by Benj »

Hello,

I've created a new ILI9341 SPI component for you which has the SPI CAL built in rather then simply bit banging out the data to the display.

Hopefully it should run significantly faster but has the downside now of having limited fixed hardware SPI pins and also the MISO pin connection. Note this isn't actually used and so doesn't need to connect to anything on the display. It's only listed as a heads up that you won't be able to use the pin for anything else.

Use the updates system to download the new component.

Let us know how you get on.

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi benj

Thanks for reply.

We tried to insert the new cal but when we compile it returns this error

Unknown or missing port variable: $PORTC.2

best regards
Attachments
MX230F256B_SPI_HW_new.pdf
(226.69 KiB) Downloaded 72 times

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi Benj

thanks for reply

We have downloaded the new cal, but when we try to compile it returns the following error

display_test_9341_SPI_new_image_01_macro_test.c : 3788:error : Unknown or missing port variable: $PORTC.2
display_test_9341_SPI_new_image_01_macro_test.c : 3957:error : Unknown or missing port variable: $PORTC.2

best regards
Attachments
MX230F256B_SPI_error_compilation.pdf
(226.39 KiB) Downloaded 61 times
MX230F256B_SPI_HW_new.pdf
(226.69 KiB) Downloaded 62 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1191
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: Pic32mx230 slow spi clock

Post by QMESAR »

Hi
Please stop to post pdf images !
No body can debug pdf's please post your flowchart !

User avatar
Benj
Matrix Staff
Posts: 14851
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Pic32mx230 slow spi clock

Post by Benj »

Hello,

It's compiling ok here for me on a PIC32MX device. Please can you check the component properties that all the pins and remap pins have correctly been allocated.

As stated by Qmesar we can't do much to debug your pdf documents, just attach the fcfx flowcode project and that should save you some time and allow us to investigate.

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi benj

the version of pic we are using does not have the c port ( PIC32MX230F256H)

If you try to compile it, it will return the error

In attachment the flowchart.

Best regards
Attachments
Display_test_9341_SPI_new_image_01.fcfx
(15.37 KiB) Downloaded 54 times

User avatar
Benj
Matrix Staff
Posts: 14851
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Pic32mx230 slow spi clock

Post by Benj »

Hello,

Many thanks I've found the cause of the problem now. The auto CS was left enabled in the SPI CAL component. I've now disabled this and pushed to the update system again. Fingers crossed if you update the component then it should now be fixed and compile correctly.

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi benj

we downloaded the new release and ...... it works! :D :D :D

now we are pushing the bus to the limit 8)

Many thanks

jgu1
Posts: 1189
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: Pic32mx230 slow spi clock

Post by jgu1 »

Hi Ben!

I can see that it is for Pic32 But has it any affect on Arduino? If not, is it possible to speed the SPI up for ili9341 on Arduino also?

Br Jorgen

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hello

When program call gLCD_ili9341_spi how there set this registers?

REGISTER SPI1CON
REGISTER SP1BRG
REGISTER SPI1CON2

Is it possible read the value of this register in flowcode .C output?

Now spi is running at 24 Mhz, in according to our pic datasheet is the maximum value.

Data Spi is 8bit framed. Is it possible increase to 32bit framed?

Best regards

User avatar
Benj
Matrix Staff
Posts: 14851
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Pic32mx230 slow spi clock

Post by Benj »

Hello,

The old ILI9341 component uses bit banged SPI using standard I/O.

The new ILI9341_SPI component uses the SPI CAL and so can use Hardware SPI on any target, including Arduino. Should run faster but downside is you loose the pin assigned to the SPI MISO.

The SPI properties can be set via the component properties. To see the code that accesses the SPI registers you would have to look in the CAL/FAMILY/CAL_FAMILY_SPI.c file.

You can read registers by using a C icon in your Flowcode project. first create a Flowcode variable called reg. Then add the following code into a C code icon and it will load the reg variable with the value from the register.

Code: Select all

FCV_REG = SPI1CON;
Data Spi is 8bit framed. Is it possible increase to 32bit framed?
We don't currently support this though I'll add it to the list for future investigation.

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi benj

thanks for reply

we try to compile the program using the display with ILI9341 in HW SPI on a faster PIC32MX440F256H.

The compiler shows an error. It is possible to solve?

is it possible to improve the speed of the Bitmap Drawer component?

Best Regards
Attachments
Display_ILI9341_MX440_new.msg.txt
(2.45 KiB) Downloaded 20 times
Display_ILI9341_MX440_new.fcfx
(20.29 KiB) Downloaded 20 times

User avatar
Benj
Matrix Staff
Posts: 14851
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Pic32mx230 slow spi clock

Post by Benj »

Hello,
we try to compile the program using the display with ILI9341 in HW SPI on a faster PIC32MX440F256H.
It seems this device doesn't have a channel 1 but does have a channel 2, please can you check the component properties have been set correctly.
is it possible to improve the speed of the Bitmap Drawer component?
It should already be fairly efficient, though I can certainly have a look.

Alkaline
Posts: 119
Joined: Mon Aug 20, 2018 11:04 am
Contact:

Re: Pic32mx230 slow spi clock

Post by Alkaline »

Hi benj

Thanks for you reply, now we are running on pic32mx440f256h at 40Mhz on spi.

You can see the screenshot of the oscilloscope.

In the second image, it is possible to note the time interval between a data packet and another. 1.780uS.

Is it possible reduce the time interval between data packet?

we have to load several bitmap as fast as possible

Best regards
Attachments
IMG_4828.JPG
IMG_4828.JPG (115.16 KiB) Viewed 3004 times
IMG_4827.JPG
IMG_4827.JPG (124.53 KiB) Viewed 3004 times

Lagoda
Posts: 153
Joined: Fri Jul 15, 2016 9:51 pm
Contact:

Re: Pic32mx230 slow spi clock

Post by Lagoda »

Hi Ben,

I also experienced this phenomenon.
I am using PIC32MX370F512H MCU.

Would it be possible to shorten the time between sent bytes of the SPI bus ?

Best Regards,

Lagoda

Post Reply