Is it possible to eliminate use of SPI_Set_Active?

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
Const50
Posts: 124
Joined: 28 Oct 2010 15:08
Location: West Siberia, Tomsk

Is it possible to eliminate use of SPI_Set_Active?

#1 Post by Const50 » 30 Jun 2014 17:04

I use two SPI: one (SPI2) for transfer image data from MMC to MCU's internal RAM, another (SPI4) - for transferring data from MCU RAM into TFT controller's SRAM. Since MCU RAM has not enough volume, data transferred by many pieces. Since I use two SPI, I must apply presented in SPI library SPI_Set_Active procedure to activate SPIs.
It is very complicated, because switching SPI2 -> SPI4 -> SPI2 -> SPI4 ->...occurs very often, overloads the code and takes a lot of execute time.
Questions:
1. Is it possible to activate SPIs not during code execution process sequently, but at one time, before data transferring, somewhere in Initialization phase?
2. What for need the SPI_Set_Active procedure at all, since used SPIs pointed explicitly: SPI2, SPI4? If I use SPI2, I dont use SPI4 and vise versa...

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: Is it possible to eliminate use of SPI_Set_Active?

#2 Post by phil31 » 01 Jul 2014 16:08

hi,

what is the target please ?
the first PIC32 I found with 4 SPI are in the PIC32MZ serie that are not supported for now

regards

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: Is it possible to eliminate use of SPI_Set_Active?

#3 Post by dejan.odabasic » 01 Jul 2014 16:29

Hello,

If you project(code) doesn't use generalized SPI functions - SPI_Write, SPI_Read.
Then you don't need to use SPI_Set_Active function.
You can simple use SPI functions with designated module number.

Code: Select all

// Transfer image to MMC
SPI2_Read()
...

// Transfer image to TFT
SPI4_Write()
...
Best regards.

Const50
Posts: 124
Joined: 28 Oct 2010 15:08
Location: West Siberia, Tomsk

Re: Is it possible to eliminate use of SPI_Set_Active?

#4 Post by Const50 » 02 Jul 2014 07:12

Hm-m-m...
But if I have only one SPI and use generalized SPI functions - SPI_Write, SPI_Read, I the more don't need this (SPI_Set_Active) function, isn't it?
So as and when there is more than one SPI with different numbers...
A?

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Is it possible to eliminate use of SPI_Set_Active?

#5 Post by marina.petrovic » 03 Jul 2014 15:04

Hi,

If you use generic routines, SPI_Read() and SPI_Write() you need to use SPI_Set_Active() routine with which you "activate"
one of the SPI modules (if you use more then one SPI module and/or if MCU which you use have more then one SPI module).

But if you do not want to use SPI_Set_Active() routine, you simple can use SPI functions with designated module number,
like my colleague already explained.

Best regards,
Marina

Const50
Posts: 124
Joined: 28 Oct 2010 15:08
Location: West Siberia, Tomsk

Re: Is it possible to eliminate use of SPI_Set_Active?

#6 Post by Const50 » 04 Jul 2014 14:49

O'K...
Anyway thank you.

Post Reply

Return to “mikroBasic PRO for PIC32 General”