NRF52840 - can't define char array longer than 8 chars

Robert_Darabos
Mon, 20 Dec 2021 17:35:22 +0000
Custom and community boards

Hi, I’m experiencing some weird behavior when I define arrays. The code compiles. When I download it to NRF52840, the following happens:

char buf[8] = {“$PMTK00”}; //works
char buf[9] = {“$PMTK000”}; //does not work
char buf[14] = {“$PMTK000*32\r\n”} //does not work

char buf2[2] = {‘$’, ‘P’}; //works
char buf2[6] = {‘$’,‘P’,‘M’,‘T’,‘K’,‘0’};//works
char buf2[7] = {‘$’,‘P’,‘M’,‘T’,‘K’,‘0’,‘0’}; //does not work
char buf2[8] = {‘$’,‘P’,‘M’,‘T’,‘K’,‘0’,‘0’,‘0’}; //does not work
char buf2[13] = {‘$’,‘P’,‘M’,‘T’,‘K’,‘0’,‘0’,‘0’,‘*’,‘3’,‘2’,‘\r’,‘\n’}; //does not work

By not working I mean that NRF52840 doesn’t appear on nrfConnect and doesn’t show any life signs so I guess there’s an internal error. I can’t debug the chip, I have no UART.

Does anybody have an idea what causes this chaotic behavior and how can I fix it? Thanks

3 posts - 2 participants