Configure the Usart module as the most basic SPI mode. No interruption, dead loop sent.
Example:
#include <stdint.h>
#include <stdbool.h>
#include "Efm32.h"
#include "Efm32_chip.h"
#include "Efm32_cmu.h"
#include "efm32_gpio.h"
#include "Efm32_usart.h"
void spi_initial (void)
{
cmu_clockenable (Cmuclock_hfper, true);
Cmu_clockenable (Cmuclock_gpio, true);
cmu_clockenable (Cmuclock_usart1, true);
usart_initsync_typedef spi_init = usart_initsync_default;
& nbsp; spi_init.baudrate = 200000;
usart_initsync (USART1, &spi_init);
Gpio_pinmodeset (gpioportd,0,gpiomodepushpull,1); TX
Gpio_pinmodeset (gpioportd,1,gpiomodeinput,1); //rx
Gpio_pinmodeset (gpioportd,2,gpiomodepushpull,1); CLK
Gpio_pinmodeset (gpioportd,3,gpiomodepushpull,1);//cs
Usart1->route |= Usart_route_cspen | Usart_route_clkpen | Usart_route_txpen | Usart_route_rxpen | Usart_route_location_loc1;
}
/**************************************************************************//**
* @brief Main function
*****************************************************************************/
/**************************************************************************//**
* @brief Main function
*****************************************************************************/
int main (void)
{
/* Chip Errata */
Chip_init ();
Systemcoreclockupdate ();
Spi_initial ();
/* Infinite Blink loop */
while (1)
{
unsigned long uldelay = 4000;
while (uldelay--);
Usart_tx (usart1,0x55);
}
}