Git Product home page Git Product logo

bsics-svr's People

Contributors

misterhw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

elmot mayaposch

bsics-svr's Issues

STM32 I2C lock-up when HAL_UART_Transmit() used in other task

At commit 4a7f4ec ,

  • scpi server task uses iprintf() and consequently HAL_UART_Transmit() for debug output
  • default task periodically issues HAL_I2C_Master_Transmit() and HAL_I2C_Mem_Write()

Even the UART messages

iprintf("***Connection closed\r\n");
printf("***Control Connection closed\r\n");

are sufficient to cause I2C1 and eventually I2C2 to lock up with clock (and occasionally SDA due to true slave device lock-up) stuck low:

photo_2021-10-23_13-03-12

The last bits exchanged are always part of a full byte + ACK and mostly observed during the long HAL_I2C_Mem_Write() to update SSD1306.

photo_2021-10-23_13-02-59

Overall, the periodic timing is much more stretched out as I2C1 and I2C2 comms are interleaved:

photo_2021-10-23_13-03-04

I2C_RequestMemoryWrite()


fails during start-up as devices are detected and their status is reported. Later (when opening and closing a TCP connection and causing the associated reporting via UART), I2C_WaitOnTXISFlagUntilTimeout()
fails when the above breakpoint is removed. Subsequent issues are encountered earlier when I2C_WaitOnFlagUntilTimeout()
fails.

The timeout value passed is equivalent to 25 ms. Extending timeouts to 250 ms does not fix the issue.

#define I2C_TIMEOUT_BUSY (25U) /*!< 25 ms */

HAL I2C functions do not seem to fail gracefully, transmissions are not completed and I2C bus functionality is not recovered.

Ideal solution: interrupt or DMA-based handling of UART transfers (see https://stm32f4-discovery.net/2017/07/stm32-tutorial-efficiently-receive-uart-data-using-dma/). Currently no received characters are being processed, so UART does not need to block program execution at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.