Dear users,
I would like to ask for advice on an error that has appeared and which I am unable to resolve.
Some important information:
-I am working on an esp32 from Sparkfun,
-I am writing a PC application communicating with the ESP32 module via wired(UART) and wireless(UDP to send samples to PC and TCP to send commands to ESP)
-I write the ESP software using ECLIPSE environment in C and the PC application in QtCreator in C++
-I work on Windows 10
I will briefly describe the process and highlight the problem:
1. I turn on the PC application
2. I connect the ESP
3. i click "connect" in the app and here is my ERROR - no data coming in REASON: When i turn on the app, a TCP server is created, when i connect the ESP, a TCP client is created, if i connect the esp and click "connect" too quickly in the app, the client does not have time to create on the esp
From this I conclude that the initialisation process of the ESP takes a long time compared to the running of the application on the PC. An additional problem is that
closing the USB port always causes ESP to reset: I connect via UART, disconnect, click Connect WIFI and the same thing happens again: because of the reset ESP has not had time to create the client. I do not check whether a client has already been created in the PC application, simply the application recognises that there is a connection, then I click DISCONNECT in the PC application and by now a client has been created
and then the data starts coming in.
What actually happens is that when I click the connect or disconnect button, a #5g* command is sent via UART or TCP depending on the type of connection selected, and on this command the ESP32 changes to the opposite state sending=!sending. This is a very simple solution.
Can anyone suggest how to reconcile the long initialisation time (or reduce it) with the operation of the PC application?
I am attaching a demonstration of the problem as a video and relevant code snippets.
.
Github- full code
Initialisation fragment in main.c
Function wifi_init_sta() in udp.c
Function udp_conn in main.c
Function uart_communication in main.c
If anyone would like help, please have a look at Github- full code to see the definitions of the other functions.
spi_init() in spi.c
initAG() in mki159v1.c
initMagnet() in mki159v1.c
setPinLevel(1,1) in adc.c
initialize_adcs() in adc.c
initializeTIMER() in timer.c
Greetings!
I would like to ask for advice on an error that has appeared and which I am unable to resolve.
Some important information:
-I am working on an esp32 from Sparkfun,
-I am writing a PC application communicating with the ESP32 module via wired(UART) and wireless(UDP to send samples to PC and TCP to send commands to ESP)
-I write the ESP software using ECLIPSE environment in C and the PC application in QtCreator in C++
-I work on Windows 10
I will briefly describe the process and highlight the problem:
1. I turn on the PC application
2. I connect the ESP
3. i click "connect" in the app and here is my ERROR - no data coming in REASON: When i turn on the app, a TCP server is created, when i connect the ESP, a TCP client is created, if i connect the esp and click "connect" too quickly in the app, the client does not have time to create on the esp
From this I conclude that the initialisation process of the ESP takes a long time compared to the running of the application on the PC. An additional problem is that
closing the USB port always causes ESP to reset: I connect via UART, disconnect, click Connect WIFI and the same thing happens again: because of the reset ESP has not had time to create the client. I do not check whether a client has already been created in the PC application, simply the application recognises that there is a connection, then I click DISCONNECT in the PC application and by now a client has been created
and then the data starts coming in.
What actually happens is that when I click the connect or disconnect button, a #5g* command is sent via UART or TCP depending on the type of connection selected, and on this command the ESP32 changes to the opposite state sending=!sending. This is a very simple solution.
Can anyone suggest how to reconcile the long initialisation time (or reduce it) with the operation of the PC application?
I am attaching a demonstration of the problem as a video and relevant code snippets.
Github- full code
Initialisation fragment in main.c
Code: C / C++
Function wifi_init_sta() in udp.c
Code: C / C++
Function udp_conn in main.c
Code: C / C++
Function uart_communication in main.c
Code: C / C++
If anyone would like help, please have a look at Github- full code to see the definitions of the other functions.
spi_init() in spi.c
initAG() in mki159v1.c
initMagnet() in mki159v1.c
setPinLevel(1,1) in adc.c
initialize_adcs() in adc.c
initializeTIMER() in timer.c
Greetings!