EmbDev.net

Forum: ARM programming with GCC/GNU tools ARM_SPI_Doubt


Author: Supriya (Guest)
Posted on:

Rate this post
0 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.

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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

Author: Supriya (Guest)
Posted on:

Rate this post
0 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.

Author: Supriya (Guest)
Posted on:

Rate this post
0 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?

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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.

Author: Supriya (Guest)
Posted on:

Rate this post
0 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?

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.