SPI1_Init_Advanced() on P24FJ1024GB610 parameters?

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Slinger251
Posts: 3
Joined: 15 Nov 2022 14:59

SPI1_Init_Advanced() on P24FJ1024GB610 parameters?

#1 Post by Slinger251 » 15 Nov 2022 15:16

Hi,
got an issue with the P24FJ1024GB610 when using the SPI1_Init_Advanced() function.
From the docu I found it has 8 parameters, but if do so I get errors as

SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_PRESCALE_SEC_1, _SPI_PRESCALE_PRI_64, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);

two identifiers not found + to much parameters. When using the "Parameter Assistant" for a function it tells me 7 instead of 8 parameters!?

OK - what parameters to use? from the "Parameter Assistant" it looks like I got:
// master_mode, mode16, sec_prescaler , data_sample, , clock_idle , brgDiv , Clock Edge
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, , _SPI_ACTIVE_2_IDLE);

nice - no idea what brgDiv is and what are the params I can choose from.

in general - when using just SPI1_Init(); we got the SW running, but it is very slow, I expected to have configure to a faster setting with SPI1_Init_Advanced() - but the prescaler parameters are not there on this µC?
So no chance to get more speed?

thanks a lot for supporting....

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: SPI1_Init_Advanced() on P24FJ1024GB610 parameters?

#2 Post by filip » 18 Nov 2022 10:58

Hi,

The function declaration fro this MCU is as follows :

Code: Select all

void SPI1_Init_Advanced(unsigned master_mode, unsigned mode16, unsigned slave_select, unsigned data_sample unsigned clock_idle, unsigned brgDiv, unsigned edge);
For example :

Code: Select all

SPI2_Init_Advanced(_SPI_MASTER,
                     _SPI_8_BIT,
                     _SPI_SS_DISABLE,
                     _SPI_DATA_SAMPLE_MIDDLE,
                     _SPI_CLK_IDLE_LOW,
                      20,
                     _SPI_IDLE_2_ACTIVE);
brgDiv is a parameter for the baudrate generator divider bits written into SPIxBRGL register.

Regards,
Filip.

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 General”