Comments (10)
Hi Rob, I still couldn't find the error.
from ubxlib.
Hi Alex: searching the code for eventTask
, that would seem to be the UART callback task:
ubxlib/port/platform/esp-idf/src/u_port_uart.c
Lines 514 to 519 in ffa9636
The usual way to check this would be to hack the code above to add a fixed amount, say 2048 bytes, to the stack requested for that task in the function call (i.e. stackSizeBytes + 2048
) and then monitor the "low watermark" of that stack by calling uPortUartEventStackMinFree(), periodically from your application. If you see it go below 2048 bytes then you have found the problem case. It is quite likely to be some particular combination of events that causes a sudden jump in stack usage, rather than a slow reduction; at least that would be my guess.
Once you have the problem case, you can decide whether it is something that can be fixed somehow or whether it is just expected operation, in which case the stack size would need to be increased somewhat at the point that the UART event task is created:
ubxlib/common/at_client/src/u_at_client.c
Lines 2839 to 2843 in ffa9636
This you could do by overriding U_AT_CLIENT_URC_TASK_STACK_SIZE_BYTES at build time.
from ubxlib.
uPortUartEventStackMinFree expects a handle.
Where can I get this?
from ubxlib.
Ah, yes, sorry, you can get it with something like the following (this code not compiled by me, just to point you in the right direction):
// Assuming that your device handle is in devHandle
uAtClientHandle_t atHandle = NULL;
uAtClientStreamHandle_t stream = U_AT_CLIENT_STREAM_HANDLE_DEFAULTS;
if (uCellAtClientHandleGet(devHandle, &atHandle)) == 0) {
uAtClientStreamGetExt(atHandle, &stream);
if (stream.type == U_AT_CLIENT_STREAM_TYPE_UART) {
// The UART handle of the AT client for the cellular device is now in stream.handle.int32
printf("Calling uPortUartEventStackMinFree() on UART handle %d gives %d bytes.\n",
stream.handle.int32,
uPortUartEventStackMinFree(stream.handle.int32));
} else {
printf("AT client handle %p has stream handle type %d (expected %d)!\n",
atHandle, stream.type, U_AT_CLIENT_STREAM_TYPE_UART);
}
} else {
printf("Unable to get AT client handle for device %p!\n", devHandle);
}
from ubxlib.
several times at the beginning:
Calling uPortUartEventStackMinFree() on UART handle 1 gives 2424 bytes.
and finally several times:
Calling uPortUartEventStackMinFree() on UART handle 1 gives 2184 bytes.
from ubxlib.
Getting a bit low but always above 2048, so you haven't reached a stack overflow case yet I think.
from ubxlib.
The problem does not always occur. I try to restart the process to possibly catch the overflow.
So far I have also seen the following value:
Calling uPortUartEventStackMinFree() on UART handle 1 gives 2088 bytes.
How does it even come about that the value is different?
from ubxlib.
How does it even come about that the value is different?
Timing and different paths through the code will generally cause stack usage to differ between runs. But like I say, I suspect your issue is not so much a grey-scale thing as something that suddenly goes off the rails, a bug of some form.
So you've never seen the stack of the UART event queue task go below 2048 bytes minimum free with the 2048 bytes hacked-in?
from ubxlib.
One thing you could potentially try is setting CONFIG_COMPILER_STACK_CHECK_MODE to something other than CONFIG_COMPILER_STACK_CHECK_MODE_NONE
(the default). This will tell the compiler to add additional stack guards on a per-function basis to check for stack breaches that will be checked on entry and exit.
The issue with this is that it will change the run-time behaviour, 'cos of all the checking going on, and that may have other effects, but if you haven't managed to trap the problem yet and you think it should have occurred by now then it may be worth a try.
from ubxlib.
Hi @alexmaron81: how did this go in the end?
from ubxlib.
Related Issues (20)
- SAM-M10Q Current Draw Issue 3.3V, ~1mA instead of ~10mA HOT 5
- Zephyr device tree BLE NUS in nRF52832 HOT 8
- Cannot establish an MQTT connection from Thailand HOT 9
- ESP-IDF can not initialise port HOT 2
- Unable to activate PDP context HOT 10
- uNetworkInterfaceUp: pCfg is not optional for U_NETWORK_TYPE_CELL HOT 2
- No Port Logging
- SARA-R5 Power On and Enable expected hardware connections HOT 11
- Refresh radio parameters delay HOT 4
- ESP-IDF OTA update with cellular network interface HOT 6
- uGnssPosGet sometimes fails with U_ERROR_COMMON_NOT_INITIALISED HOT 18
- Using ubxlib to interface two ublox peripherals HOT 3
- strncpy faills to compile in ESP-IDF HOT 5
- Ublox MAX-M10: Getting errror -5 for uGnssInfoGetVersions and -2 for uGnssPosGet HOT 2
- Unable to bring up GNSS! HOT 21
- USECMNG invalid certificate/key format HOT 18
- esp32c6 i2c m10 HOT 7
- uCellInfoGetTimeUtc - AT+CCLK sometimes returns invalid date HOT 3
- esp idf i2c legacy driver issue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ubxlib.