Apr 11, 2019
11:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 11, 2019
11:46 PM
Good Morning Forum Member,
I want to generate a SCLK frequence of 8 kHz, by SPI I can said that this is equal tp 8 kbit/s correct?
now I have the problem which baudrate (nummeric value) is nessessary that the XMC LIB function
That the function below, called by XMC_SPI_CH_Init is set the register that the clock is work with 8 kHz
Remarks: Frequency calculation by XMC Datasheet
fpheriph = 144 MHz --> 1/1000 (Fractional Devider) --> f = 144 kHz ---> PDIV f*1/9 ---> f = 16 KHz --> Div by 2 f*1/2 --> fsclk = 8 KHz
But what value I need for uint32_t baudrate to set the register that the frequency calculation above is made.
Best regards
Ebbe Sand
I want to generate a SCLK frequence of 8 kHz, by SPI I can said that this is equal tp 8 kbit/s correct?
now I have the problem which baudrate (nummeric value) is nessessary that the XMC LIB function
/**
* Structure for initializing SPI channel.
*/
typedef struct XMC_SPI_CH_CONFIG
{
uint32_t baudrate; /**< Module baud rate for communication */
XMC_SPI_CH_BUS_MODE_t bus_mode; /**< Bus mode: Master/Slave */
XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t selo_inversion; /**< Enable inversion of Slave select signal relative to the internal
MSLS signal */
XMC_USIC_CH_PARITY_MODE_t parity_mode; /**< Enable parity check for transmit and received data */
} XMC_SPI_CH_CONFIG_t;
That the function below, called by XMC_SPI_CH_Init is set the register that the clock is work with 8 kHz
XMC_SPI_CH_STATUS_t XMC_SPI_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate)
{
XMC_SPI_CH_STATUS_t status;
status = XMC_SPI_CH_STATUS_ERROR;
if (rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 1U))
{
if (XMC_USIC_CH_SetBaudrate(channel, rate, XMC_SPI_CH_OVERSAMPLING) == XMC_USIC_CH_STATUS_OK)
{
status = XMC_SPI_CH_STATUS_OK;
}
}
return status;
}
Remarks: Frequency calculation by XMC Datasheet
fpheriph = 144 MHz --> 1/1000 (Fractional Devider) --> f = 144 kHz ---> PDIV f*1/9 ---> f = 16 KHz --> Div by 2 f*1/2 --> fsclk = 8 KHz
But what value I need for uint32_t baudrate to set the register that the frequency calculation above is made.
Best regards
Ebbe Sand
- Tags:
- IFX
2 Replies
Apr 12, 2019
09:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 12, 2019
09:20 AM
Hi,
Should do it??
Regards,
Jesus
.baudrate = 8000,
Should do it??
Regards,
Jesus
Apr 15, 2019
12:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 15, 2019
12:23 AM
Hi Jesus,
Sometimes things can be so easy that you can believe it. But now for your question yes it works.
Thanks for your help and a successful week.
Best regards
Ebbe Sand
Sometimes things can be so easy that you can believe it. But now for your question yes it works.
Thanks for your help and a successful week.
Best regards
Ebbe Sand