Forums » Req. WJ2(ESP32) support »
UIDRead_demo problems
Added by Johan Henning over 1 year ago
I tried to build the UIDRead_demo (on the Cucumber GRDE3927).
During compilation the following warnings/errors appear:
Source 'uidread_demo/UIDREAD' specifies that its sample time (-1) is back-inherited. You should explicitly specify the sample time of sources. You can disable this diagnostic by setting the 'Source block specifies -1 sample time' diagnostic to 'none' in the Sample Time group on the Diagnostics pane of the Configuration Parameters dialog box. [5 similar]
The model reference sample time inheritance rule for block 'uidread_demo/String Processing' is not set and the model is sample time independent. The generated code from the block might produce incorrect results if it is referenced by a Model block. For S-functions, specify the model reference sample time inheritance rule through the ssSetModelReferenceSampleTimeInheritanceRule macro. You can suppress the diagnostic by setting Unspecified inheritability of sample time to 'none'. [8 similar]
The input vector of 'uidread_demo/ASCII to String' requires a buffer size of '513' bytes to store all characters, and a null terminator at the end. This required buffer size exceeds the buffer size ('256' bytes) of the dynamic string specified by the configuration parameter “Buffer size of dynamically-sized string”. For generated code, the ASCII To String block truncates the string output to fit the buffer of '256' bytes. To avoid truncation, consider increasing the string buffer size.
When running the program the following is shown on the terminal (repeated indefinitely):
Removing the ASCII to String block and setting the printf block to character vector instead of to string variable resolves the third message but does not solve the problem.
Replies (4)
RE: UIDRead_demo problems - Added by Parth Maheshwari (พาร์ท) over 1 year ago
Hi Johan,
I was able to reproduce your error on my ESP32S2 board. Let me check and get back to you.
Sincere regards,
Parth
RE: UIDRead_demo problems - Added by Parth Maheshwari (พาร์ท) over 1 year ago
Hi Johan,
We will release a patch soon for this. However, this issue can be solved by simply removing the Waijung 2 UIDREAD block used to get Bluetooth MAC address (ESP_MAC_BT) from the model [in green below] and re-running the model. The reason being: ESP32S2 core boards don't have a bluetooth module, hence the error in trying to extract the bluetooth MAC address.
Please give it a try and let me know.
Sincere regards,
Parth
RE: UIDRead_demo problems - Added by Johan Henning over 1 year ago
I removed the bluetooth block. I had to remove the "BT_MAC-%s\n" from the sprintf block as well to avoid this error:
Error: Simulink Coder Error: Waijung 2 String processing block: %s format specifier cannot be used with a port width of 1. Please use %c instead of %s
Now it works fine.
Maybe there is a possibility in Simulink to include or exclude the bluetooth part depending on the chosen ESP variant. The idea of conditional compilation back in the C/C++ days. Otherwise I think two variants of the example would be nice.
Regards,
johan.
RE: UIDRead_demo problems - Added by Johan Henning over 1 year ago
Another option would be to let the unique_devide_id block return and error string (for example: no bluetooth module detected) instead of causing a crash. Some form of try / catch mechanism.
Or provide an error output signal indicating that everything went well or not.