Issue running BLE sniffer on ESP32 complied with platform IO - visual-studio-code

here is the problem I'm searching for help for: I've created an example program for testing BLE advertisement using exactly the source found in:
https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLETests/SampleServer.cpp
with a tiny addition of prints to make program progress visual.
When running the single file in Arduino it works perfectly as expected.
However, building it with vscode & platformio with the right setup, the program waits forever.
The right setup means correct board & Arduino platform selections which work perfectly for me for lots of other functionalities (BLE, WiFi, etc).
Following is the line where the program is waiting forever:
Thank you.
The code to run when compiled with VScode PlatfromIO

Related

Raspberry pi pico w unable to import dht module

I was using a dht22 sensor in my raspberry pi pico w board but suddenly I can't anymore
I get the following error when trying to import dht module:
ValueError: incompatible .mpy file
I tried updating the micropython firmware to the latest version but the problem persists.
My DHT22 module is a bit faulty since I connected it backwards the first time, but it was working ok, sometimes it emits a high pitched noise, but after reconnecting it it worked normally, now It emits the sound constantly.
However the error appears regardless of the sensor being connected or not, just by calling "import dht" without any extra code.
The rest of the functions of the board are still working, I can blink the led, drive a relay module, run a web server, all the other functions of my application work normally.
After looking at the files loaded in my board an extra file was present:
dht.mpy
The file had contents from my log function (a function I use to write exceptions to a file)
I have no clue how this happened, but deleting it solved the problem

Twincat Activate Configuration error 0x1028 - unable to activate

I am a beginner in Twincat and is trying to run a sample program on my system(not on target).
I did all the steps mentioned here and did get the system up and running my sample code once. However, when I tried to run it again after a system restart, I get an error message.
I tried creating a new empty solution and another one with test code, both of them throws the same error code. Also, when I click on the green Restart TwinCat system button, I get the following error.
How do I solve this?
You need to enable AMD-V in your BIOS.
The procedure is explained here:
https://youtu.be/P9uUgT8EhUM?t=1029
(This is done for an Intel system, while you seem to have an AMD system, but it's the same procedure).
Also make sure to run this file in CMD (as Administrator):
C:\TwinCAT\3.1\System\win8settick.bat
And then reboot your computer.
If this doesn't do the trick, then do core isolation and run your TwinCAT task on an isolated core. Maybe that was what you were doing before but not now? It's described quite well in this video: https://youtube.com/watch?v=q7iRvDuAOFQ

STM32F103C8T6 board not flashing with Keil 5

I have the following problem. Once i generate Keil project using ST CubeMX and write project into STM32F103C8 MCU, everything goes well; However, after this first flashing i'am not able to flash it anymore as it throws the following error:
Error: Flash Download failed - Target DLL has been cancelled
I have pulled Boot0 pin, activated it, and erased MCU. This procedure helps only for one time flashing; however, if i flash MCU with bare metal or CMSIS code (which was not generated by CubeMX) it works fine and i can flash as many times as i want without errors.
Could you please advice, what could be wrong and how can i fix this?
Problem was in default configuration of STM CubeMx. In System core -> Sys Debug was switched off by default. After i changed it to Serial Wire it worked.

Debugging embedded system with Eclipse - HOW TO PRINT TO A LOGGING FILE?

I'm currently working on a project on STM32F4 and I'm using Eclipse. I've got some problems with the program - it seems to have a random behavior - sometimes it works fine, other times it has some errors. Sometimes when I try do debug with breakpoints I get the beautiful HardFault Handler and it really messes with my brains.
Sorry for the little off-topic paragraph, just wanted to let you know why I decided to use printing to a log file at some key moments in the program so I can see in which states and in which functions does the problem occur. I'm debugging through a JTAG interface with Eclipse (gdb) and I need to know if there is an easy method integrated in Eclipse that may help me use fprintf-like functions inside my program to write to a file on the disk.
If no, any other solutions?
Thanks
I do not like to connect the debug output log to the Jtag communication port because the log will not be available after development.
I usually build an SystemLog library that can send the log messages through any medium that is available (UART, USB, Ethernet or SDCARD). That's what I'd recommend you to do. It will help you through the development, and the support team on the event of any failure on field.
If stdlib is available in your project you should use the snprintf family functions to build your SystemLog.
Also, you can integrate the log output to the eclipse console by calling a serial console communicator (if you use UART) on you makefile, in this case, your makefile will have to flash the target as well.

Debugging STMF4 Discovery in Eclipse using GDB

Hello all: I have never posted on Stackoverflow, but I have always come here for help for years.
I have a question and problem regarding debugging in eclipse using an STLINK STM32 Discovery board. I have looked online for the answer and have followed many tutorials, but I still cannot seem to get it to work correctly. I will try my luck at asking here.
I have set up the eclipse environment correctly with my compiler and gdb server (to my knowledge). First I make sure the server is started before I press debug in eclipse. I am using Atollic STLINK gdb server. I have tried many arm-none-eabi-gdb type exe's while debugging, but they all seem the same. My debug configuration is setup to use arm-none-eabi-gdb on port 61234 (Attolic). When I press debug, the program launches correctly and goes into the debug view in eclipse. The program downloads correctly to my discovery board. I know this because I have gotten debugging to work partially and have stepped through the code without crashing on 'some' occasions depending on the compiled code and debug configuration startup options. The code is a simple LED turn on on the board. If I unplug the usb cable and plug it back in, my code runs fine, because the LEDs light up, so we know the environment is probably set up correctly, because the code downloads to flash via eclipse commands.
The problem is with actual debug steps. 99% of the time the arm-none-eabi-gdb.exe program crashes when in the debug view after I do a few "step into's" with the debugger commands at the top of eclipse. After the first line of my main function is reached, I will try to step into the first line and I get a windows crash of the arm-eabi.exe program. The debug console in eclipse reads a gdb error: .......dwarf2: C10xx Internal Error - unknown CFA rule. Now... depending on how I set the options in the debug configuration with regards to the startup tab, different options produce different results and the following options have been toggled: Halt, resume, break point at : main, etc.. This crash also seems to be dependent on the code being compiled in the main function.
Now, does this have any dependency on which compiler is used with the gdb server and arm-none-eabi-gdb.exe programs? For instance, if I compiled the code with Atollic versus Keil versus code sourcery versus IAR, would the Attollic gdb service + arm-none-eabi-gdb programs be able to work with any compiled code? Are there some missing symbols somewhere not being generated? For reference, I am using an EVAL version of the IAR compiler tool set. If I make a project with the same code in embedded workbench using the STLINK, the code compiles and debugs fine.
What is a CFA rule? Call frame address? Am I not setting up the stack pointer or something in my program? I thought the IAR compiler took care of all that junk in the cstartup.
Any help is appreciated.
Thanks,
LostTime77