Page 1 of 1

Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 11:21 am
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

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 12:18 pm
by stefan.erni
Hello

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


regards

Stefan

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 12:30 pm
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

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 1:02 pm
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.

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 1:54 pm
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

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 2:51 pm
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

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 3:23 pm
by QMESAR
Hi
Please stop to post pdf images !
No body can debug pdf's please post your flowchart !

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 4:10 pm
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.

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 4:21 pm
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

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 5:10 pm
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.

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 5:37 pm
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

Re: Pic32mx230 slow spi clock

Posted: Mon Aug 20, 2018 9:04 pm
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

Re: Pic32mx230 slow spi clock

Posted: Tue Aug 21, 2018 8:04 am
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

Re: Pic32mx230 slow spi clock

Posted: Tue Aug 21, 2018 11:35 am
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.

Re: Pic32mx230 slow spi clock

Posted: Tue Aug 21, 2018 4:38 pm
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

Re: Pic32mx230 slow spi clock

Posted: Tue Aug 21, 2018 5:39 pm
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.

Re: Pic32mx230 slow spi clock

Posted: Tue Aug 21, 2018 6:35 pm
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

Re: Pic32mx230 slow spi clock

Posted: Sun Mar 01, 2020 9:25 pm
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