Skip to content

STM32 SPI format 16 bit not working #15113

@JojoS62

Description

@JojoS62

Description of defect

changing SPI._spi.format(16, 0); does not work as intended.
Transmitted bytes are prepended by a zero byte.

This problem is introduced with mbed-os-6.15.0:

grafik

with mbed-os-6.14.0, the output is correct:

grafik

Target(s) affected by this defect ?

tested with STM32F407
but Problem is in targets/TARGET_STM/stm_spi_api.c and affects all STM32

Toolchain(s) (name and version) displaying this defect ?

gcc10

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.15.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

mbed-tools

How is this defect reproduced ?

#include "mbed.h"

DigitalOut  led(LED1);
DigitalOut  cs(PB_9, 1);
SPI spiDisplay(PB_5, NC, PB_3);

int main()
{
    printf("Hello, Mbed!\n");

    const char data[] = { 1, 2, 3, 4, 5, 6 };

    spiDisplay.frequency(1e6);
    spiDisplay.format(16, 0);
    
    cs = 0;
    spiDisplay.write(data, 3, nullptr, 0);
    cs = 1;

    while(1) {
        ThisThread::sleep_for(1s);
        led = !led;
    }

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions