Author Topic: Going round in circles.  (Read 610 times)

0 Members and 1 Guest are viewing this topic.

Offline paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4285
  • Country: gb
Going round in circles.
« on: October 24, 2022, 12:36:21 pm »
I'm back to trying to use ESP8266 / ESP32s with their AT command framework and not my own custom firmware.  I think if I can get reuseable code to interface that and make it easy to use it makes the effort of using them easier and more portable.  Mostly that the V2.0.0 of the Espressif AT firmware support MQTT out of the box now (and HTTP on the ESP32).

While developing it I ran into issues, it was a bear to solve, when I got there and needed to add more functionality I decided I need a "serial tap" to see both sides of the UART coms and get an understanding of what was happening on the wire.

I just happened upon a tutorial on using the USB-C port on the Black Pill board as a virtual com port.   Plenty of available UARTs so I created 2 UARTs Rx only and wrote code to read to idle both UARTs and send them one line at a time to the VCOM port with a >  or a < in them to denote direction.

It didn't work.  I spent all Sunday evening diagnosing why.  To the point of tearing the test rig apart, reassembling and trying to scope the UART.  Failing because of PC USB noise induced and my cheap scope triggering nuts.

In the end I connected the logic analyser to the UARTs and immediately spotted the problem, stepping through the STM32 HAL code confirmed it (I think).  I was reseting the ESP8266 to make it talk on the UART.  When you reset the ESP8266 it pulls it's UART lines low and holds them low until it re-init's them.  This is seen as a BREAK condition by the STM32 and instead of firing the RxEventCallback it instead fires a RxAbortCallback.  As I was re-launching the DMA receive to idle in complete call back, it never got restarted.  It was late, I gave up.

It was this morning the realisation hit me.  I spent a day trying to create a debug tool and ended up debugging IT with the tool far, far, far more capable and should have been on the bench and connected from the start.... the logic analyser.  It's smaller, faster, has 12 channels and software to pull the UART apart and show things you would miss like BREAK conditions and other control stuff you weren't aware was happening.  Like Autobaud for example.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 
The following users thanked this post: elecdonia


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf