[riot-devel] STM32L073 cpu support in conjunction with spi driver

Neo neo at nenaco.de
Tue Apr 18 10:16:20 CEST 2017


Hello Alex, thank you for your answer. I configure APB1 and 2 to work at 8Mhz because my attached device is slow. The values of the spi_divtable were new calculated via the spi_divtable tool. I wanted just know if spi was tested with the L073...
Regards, Neo

RIOT OS kernel developers schrieb:
> Hi Neo,
>
> Looking at the configuration you provide, it's hard to tell exactly what is the problem. How did you configure the clock for APB1 and APB2 in periph.conf ?
> If you set them to use highest speed (32MHz for this MCU), then the spi_divtable is wrong and you can reuse the values used for nucleo-l073 where the SPI works.
>
> Hope that it helps,
>
> Alex
>
> ----- Mail original -----
>
>> Hello RIOT developers,
>>
>> on the weekend I tried the STM32L073 support in conjunction with spi
>> support but I had no success.
>>
>> I wanted to test this on a board equiped with a STM32L073CZ MCU (48pin
>> TQFP). Therefore I made a copy of the linker file (stm32l073rz.ld ->
>> stm32l073cz.ld) and I altered the boards Makefile.include file to
>> support this derivate (export CPU_MODEL = stm32l073cz).
>>
>> I enabled spi support in the feature list inside of the Makefile
>> (FEATURES_PROVIDED += periph_spi) and altered the device descriptor in
>> the periph_conf.h file but I got no hardware response on the analyzer
>> when I tried to run the second spi interface (SPI2). The MCU does nothing.
>>
>> /**
>>   * @name    SPI configuration
>>   *
>>   * @note    The spi_divtable is auto-generated from
>>   *          `cpu/stm32_common/dist/spi_divtable/spi_divtable.c`
>>   * @{
>>   */
>> static const uint8_t spi_divtable[2][4] = {
>>      {       /* for APB1 @ 8000000Hz */
>>          5,  /* -> 125000Hz */
>>          3,  /* -> 500000Hz */
>>          2,  /* -> 1000000Hz */
>>          0   /* -> 4000000Hz */
>>      },
>>      {       /* for APB2 @ 8000000Hz */
>>          5,  /* -> 125000Hz */
>>          3,  /* -> 500000Hz */
>>          2,  /* -> 1000000Hz */
>>          0   /* -> 4000000Hz */
>>      }
>> };
>>
>> static const spi_conf_t spi_config[] = {
>>          {
>>          .dev         = SPI1,
>>          .mosi_pin = GPIO_PIN(PORT_A, 7),
>>          .miso_pin = GPIO_PIN(PORT_A, 6),
>>          .sclk_pin   = GPIO_PIN(PORT_A, 5),
>>          .cs_pin     = GPIO_UNDEF,
>>          .af            = GPIO_AF0,
>>          .rccmask  = RCC_APB2ENR_SPI1EN,
>>          .apbbus   = APB2
>>      },
>>      {
>>          .dev         = SPI2,
>>          .mosi_pin = GPIO_PIN(PORT_B, 15),
>>          .miso_pin = GPIO_PIN(PORT_B, 14),
>>          .sclk_pin = GPIO_PIN(PORT_B, 13),
>>          .cs_pin   = GPIO_UNDEF,
>>          .af       = GPIO_AF0,
>>          .rccmask  = RCC_APB1ENR_SPI2EN,
>>          .apbbus   = APB1
>>      }
>> };
>>
>> #define SPI_NUMOF           (sizeof(spi_config) / sizeof(spi_config[0]))
>> /** @} */
>>
>> The application I tried to run was the tests/periph_spi test application.
>>
>> Do I have to enable some other features or dependencies to get the spi
>> interface running?
>>
>> As far as I have seen the spi driver was rewritten since the last
>> release and I tried to configure it as described on the riot-os.org/api
>> web page.
>>
>> Any thoughts what could be wrong with this configuration?
>>
>> Thanks a lot!
>>
>> Regards,
>>
>> Neo
>>
>> _______________________________________________
>> devel mailing list
>> devel at riot-os.org
>> https://lists.riot-os.org/mailman/listinfo/devel


More information about the devel mailing list