Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32 SPI format 16 bit not working #15113

Closed
JojoS62 opened this issue Sep 27, 2021 · 4 comments
Closed

STM32 SPI format 16 bit not working #15113

JojoS62 opened this issue Sep 27, 2021 · 4 comments

Comments

@JojoS62
Copy link
Contributor

JojoS62 commented Sep 27, 2021

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;
}
@mbedmain
Copy link

@JojoS62 thank you for raising this issue.Please take a look at the following comments:

Could you add some more detail to the description? A good description should be at least 25 words.

NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'. This indicates to us that at least all the fields have been considered.
Please update the issue header with the missing information.

@JojoS62
Copy link
Contributor Author

JojoS62 commented Sep 27, 2021

#14981 is the problem,

at this point only a byte is read from the tx_buffer instead of a datasize type:

grafik

msp_write_data casts the data depending the bitshift, but a byte value is a nothing more than a byte value:

grafik

@jeromecoutant
Copy link
Collaborator

@vznncv
@LMESTM

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 26, 2022

This should be fixed by #15206

@0xc0170 0xc0170 closed this as completed Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants