EmbDev.net

Forum: ARM programming with GCC/GNU tools ARM_SPI_Doubt


von Supriya (Guest)


Rate this post
useful
not useful
Hi, i am interfacing ARM(STR71x series) to text to speech
conversion chip (SPI interfacing). I have a doubt regarding slave select
pin. Will that pin automatically become low when i write data to a arm
register? for selecting a slave device? Also configuration of clock
means edge & active high/ low this also  Not getting? One more thing any
one have WTS701.C driver??

Plz help.

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Supriya wrote:
>
>
>               Hi, i am interfacing ARM(STR71x series) to text to speech
> conversion chip (SPI interfacing). I have a doubt regarding slave select
> pin. Will that pin automatically become low when i write data to a arm
> register? for selecting a slave device? Also configuration of clock
> means edge & active high/ low this also  Not getting? One more thing any
> one have WTS701.C driver??

As far as I understand the user-manual and some STmicro
application-notes for the STR71x SPI-Interface on STR71x the
SPI-interface's hardware chip-select should be kept high in master-mode
and the external device should be selected with an extra GPIO-pin. I
have only tested with the select for SPI slaves by GPIO on STR710 so
take this information for what it's worth.

Martin Thomas

von Supriya (Guest)


Rate this post
useful
not useful
Martin Thomas wrote:
> Supriya wrote:
>>
>>
>>               Hi, i am interfacing ARM(STR71x series) to text to speech
>> conversion chip (SPI interfacing). I have a doubt regarding slave select
>> pin. Will that pin automatically become low when i write data to a arm
>> register? for selecting a slave device? Also configuration of clock
>> means edge & active high/ low this also  Not getting? One more thing any
>> one have WTS701.C driver??
>
> As far as I understand the user-manual and some STmicro
> application-notes for the STR71x SPI-Interface on STR71x the
> SPI-interface's hardware chip-select should be kept high in master-mode
> and the external device should be selected with an extra GPIO-pin. I
> have only tested with the select for SPI slaves by GPIO on STR710 so
> take this information for what it's worth.
>
> Martin Thomas
Thanks
Can u send me your SPI code for reference as, i will write down how i
have initialized it:
void InitBSPI(void)
{
  GPIO_Config(GPIO0, 0x0070, GPIO_AF_PP);  //Configure GPI00 on mode
Alternate function Push Pull
  /* Configure SCLK & SSN  clock and data lines control */
  GPIO_Config ( GPIO0, BSPI1_SSN, GPIO_OUT_PP );
  /* Set the /ss pin to high  */
//  GPIO_BitWrite(GPIO0, (u8)7, 0x1);
  /* Initialize BSPI1 device */
  BSPI_Init ( BSPI1 );
    /* Configure Baud rate Frequency: ---> APB1/6 */
  BSPI_ClockDividerConfig (BSPI1, 6);
    /* Enable BSPI1 */
  BSPI_Enable ( BSPI1, ENABLE );
    /* Configure BSPI1 as a Master */
  BSPI_MasterEnable  ( BSPI1, ENABLE );
    /* Configure the clock to be active low */
    /*Data is clocked into MOSI on the rising edge of sclk*/
  BSPI_ClkActiveHigh ( BSPI1, ENABLE );
    /* Enable capturing the first Data sample on the first edge of SCK
*/
  BSPI_ClkFEdge ( BSPI1, DISABLE );
    /* Set the word length to 8 bit , ENABLE: to enable setting the word
length to 8 bits.*/
  BSPI_8bLEn ( BSPI1, ENABLE );
}

u8 BSPI_DataSendReceive(u8 DATA)
{
  u16 data;
  u8 temp;
  data = (u16)DATA;
  BSPI_WordSend(BSPI1, DATA);
  temp = (u8)BSPI_WordReceive(BSPI1);
  #if DebugSPI
  DebugSerial1((temp/16)+'0');
      DebugSerial1((temp%16)+'0');
  #endif
  return temp;
}

These are the routines i am using plz, let me know if anything wrong in
the code.

von Supriya (Guest)


Rate this post
useful
not useful
can anyone help me how to configure and use slave select pin? Its not
getting generated?
i may not have configured some pins?

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
Try to understand the (complete) code from where you have copied the
shown lines (AN1810). It may also help if you download the STR710
eval-board uses's manual which includes the schematics and see how the
connections are wired.

von Supriya (Guest)


Rate this post
useful
not useful
Hi,

I am new to ARM , so not getting how to generate !SS?
my h/w details r as follows:

slave.SI -> STR710.S1.MOSI
slave.SO -> STR710.S1.MISO
slave.SCK -> STR710.S1.SCLK
slave.!SS -> STR710.S1.!SS

So will it work? & i am genearating !ss signals by using 1ss of STR710
as general I/O & making it high low,(dont know is this correct?)

Plz help out?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.