Page 1 of 1

Way to send data from UART

Posted: Wed Dec 01, 2021 2:59 pm
by Xbiotec
Hi Ben,
I just made a sample program to send data from UART to a Sensor.
Could tell me if this is the good way to send data a the good baud rate or do you have a better way even without LUT, with a string or EEPROM etc...
send to UART.fcfx
(10.8 KiB) Downloaded 408 times

Re: Way to send data from UART

Posted: Wed Dec 01, 2021 3:55 pm
by BenR
Hello,

That looks good to me. It really depends on if you need to be able to send different things.

As the data is fairly small you could send as a string using the following fixed string parameter. Sending as a string won't allow you to pass the value 0x00.

"\x64\x69\x03\x5E\x4E"

Or you could pop the values into a byte array and send the array. This will allow you to send the value 0x00.

data[0] = 0x64
data[1] = 0x69
etc

Re: Way to send data from UART

Posted: Thu Dec 02, 2021 3:09 pm
by Xbiotec
hi Ben,
I did different test
Console.jpg
Console.jpg (118.69 KiB) Viewed 4177 times
1- SendString like you proposed to me:
Data are well send in simulation but can not compile program , Failed attached log file
2- I don't know if data are sent to UART and there is no data in console, is it normal ?
3- Data sent and can be compiled

Could you check point 1 and 2 please

Another point without link with this
C:/esp-idf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
#warning "esp_event_loop.h is deprecated, please include esp_event.h instead"


thx

Re: Way to send data from UART

Posted: Thu Dec 02, 2021 3:10 pm
by Xbiotec
There is also many error message during compilation of my project
see the file
WifiV3.2.msg.txt
(61.41 KiB) Downloaded 423 times

Re: Way to send data from UART

Posted: Thu Dec 02, 2021 3:32 pm
by LeighM
re your first post - you need to remove the final \ character in send string
re second post - I don't see any errors, the compile and flash to device looks like it all worked ok
There are quite a few warnings, but these are normal (for now) and can be ignored.

Re: Way to send data from UART

Posted: Thu Dec 02, 2021 3:59 pm
by Xbiotec
LeighM wrote:
Thu Dec 02, 2021 3:32 pm
re your first post - you need to remove the final \ character in send string
Yes you are right !
LeighM wrote:
Thu Dec 02, 2021 3:32 pm
re second post - I don't see any errors, the compile and flash to device looks like it all worked ok
There are quite a few warnings, but these are normal (for now) and can be ignored.
Yes without final \ character in send string, no error.

Thx