STR912 SPI port

Posted by ricardo marinheiro on August 22, 2008
hi everyone

Does anyone already put SPI port of str912 working over FreeRTOS?
I’m getting a crash when i try to use 91x_ssp libraries from ST.

Every hint are wellcome

Thank to all

RE: STR912 SPI port

Posted by damien h on August 28, 2008
Hi,

Yes, i m using the SPI port under FreeRTOS, to access to a SD card, through EFSL lib, no problem, it’s working


Here, my init code, if can help you :
Regards.

Damien.



—————————————————————
#define PULS_SD_CARD_SSP_PORTSSP0
#define PULS_SD_CARD_SPEED_INIT_KBITPERSEC380

u8 HAL_InitialiseSPP(void)
{
u8 SSP_ClockRate = 0;
u8 SSP_ClockPrescaler= 0;
SSP_InitTypeDef InitSSP;


/* disable the CS of the SD Card (should be already the case, but to be sure) */
HAL_DisableSDCardChipSelect ();


/* Add clock on SSP port */
if (PULS_SD_CARD_SSP_PORT == SSP0)
{
SCU_APBPeriphClockConfig (__SSP0, ENABLE);
}
if (PULS_SD_CARD_SSP_PORT == SSP1)
{
SCU_APBPeriphClockConfig (__SSP1, ENABLE);
}


/* reset the SSP port */
SSP_StructInit (&InitSSP);
SSP_DeInit (PULS_SD_CARD_SSP_PORT);


/* Configure the port */
InitSSP.SSP_FrameFormat = SSP_FrameFormat_Motorola;
InitSSP.SSP_Mode= SSP_Mode_Master;
InitSSP.SSP_CPOL= SSP_CPOL_Low;
InitSSP.SSP_CPHA= SSP_CPHA_1Edge;
InitSSP.SSP_DataSize= SSP_DataSize_8b;
InitSSP.SSP_SlaveOutput= SSP_SlaveOutput_Disable;
InitSSP.SSP_ClockRate= SSP_ClockRate;
InitSSP.SSP_ClockPrescaler= SSP_ClockPrescaler;

HAL_SetSSPClockSpeed (PULS_SD_CARD_SPEED_INIT_KBITPERSEC);


/* Init and enable the SSP port */
SSP_Init (PULS_SD_CARD_SSP_PORT,&InitSSP);
SSP_Cmd (PULS_SD_CARD_SSP_PORT,ENABLE);

return (0);
}