This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NULL doesn't match !conn

Hello community!

I know this sounds almost impossible... but it's happening Slight smile

I'm debugging an application based on peripheral_uart. When I call 

bt_nus_send(NULL, buf->data, buf->len);
if I debug this sentence in bluetooth\services\nus.c:92:
if (!conn) {
it doesn't interpret conn as NULL (!) and the condition is never true.

I found this case app_sched_event_put NULL data pointer is not NULL - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com) but it has nothing to do with my problem.

My environment:

- Windows + Visual Studio Code + nRF Connect 

- nRF52840 DK

Any clue about where my problem is?

Thank you!

David.

  • Hi David,

    You write that you see this when debugging. Could it be simply that you have built your application with optimization and is stepping or similar? In that case the machine code will not match the C code, and things will look strange. If so, I suggest enabling debug optimization (CONFIG_DEBUG_OPTIMIZATIONS=y). If that is not the issue, then it would be interesting if you could share a project and instructions on how to reproduce so that I can have a look on my end.

    Einar

  • Hi Einar:

    Sorry for my late reply. It's probably as you say, a problem on debug optimizations, although I'm not sure 100% Anyway I don't have this problem anymore.

    Thank you,

    David.

Related