logo elektroda
logo elektroda
X
logo elektroda

[STM32] [SPI] [HAL] HAL_SPI_Transmit - sending incorrect data.

rafiks 5451 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16355809
    rafiks
    Level 18  
    I came across a strange behavior of the HAL_SPI_Transmit function below the code:

    Code: C / C++
    Log in, to see the code


    And according to what above, this part of the program should send 3 bytes of data with a value of 200 (DEC) and send 225 look at the attached waveforms. The first byte doesn't even get decoded by Saleae Logic.



    [STM32] [SPI] [HAL] HAL_SPI_Transmit - sending incorrect data. [STM32] [SPI] [HAL] HAL_SPI_Transmit - sending incorrect data. [STM32] [SPI] [HAL] HAL_SPI_Transmit - sending incorrect data.
  • ADVERTISEMENT
  • #2 16355822
    Anonymous
    Anonymous  
  • ADVERTISEMENT
  • #3 16355968
    Freddie Chopin
    MCUs specialist
    I wonder why the compiler reports warning (*) on absolutely EVERY call to HAL_SPI_Transmit ()? Well, really interesting what he means ... Probably nothing worth stupid, so who cares there ... Any type mismatch or "pointer from integer"? Flight? Szprechen zi polnish, herr compiler?

    Do you think it would be possible to ask the administrators to take a short programming test before posting a new topic on this forum?

    * - another advantage of C ++ - such stupid code in this language simply wouldn't compile and that's it.
  • ADVERTISEMENT
  • #4 16356068
    Anonymous
    Anonymous  
  • #5 16356178
    rafiks
    Level 18  
    # Piotrus_999 It's not about rearranging settings in the logic program. Only that this transmit function does not send what we give. In the attachment I am sending two pictures, one where the value is 200 (spi with avr xmegi) and the other (with stm32) another waveform.

    I've already tried different SPI settings
    CPOL = LOW
    LSB First / MSB First

    and I'm not able to get the value 200.

    [STM32] [SPI] [HAL] HAL_SPI_Transmit - sending incorrect data. [STM32] [SPI] [HAL] HAL_SPI_Transmit - sending incorrect data.
  • #6 16356203
    Anonymous
    Anonymous  
  • #7 16356236
    Freddie Chopin
    MCUs specialist
    Piotrus_999 wrote:
    Do you read the warnings, do you consider them unnecessary to return the guitar?

    After all, you can clearly see that the latter.

    rafiks wrote:
    Only that this transmit function does not send what we give.

    This function sends exactly what you gave it. But it's not 200. The compiler told you about it - with messages with a yellow background.
  • ADVERTISEMENT
  • #8 16356254
    rafiks
    Level 18  
    I did not notice that there is an asterisk there, i.e. an indicator, and not data. I've already ticked All warnings -Wall and now I can see a list of all warnings.

    Thank you for your help

Topic summary

The discussion revolves around an issue with the HAL_SPI_Transmit function in STM32, where the user reports that the function is sending incorrect data. The user attempts to transmit three bytes of data, all with a value of 200, but the received data shows unexpected values, including 225. Responses highlight the importance of checking compiler warnings related to data type mismatches, specifically the need for a pointer to uint8_t instead of a single uint8_t value. The user later acknowledges the warnings and expresses gratitude for the assistance in identifying the issue.
Summary generated by the language model.
ADVERTISEMENT