CN0359 UART issue

Hi

I need to send conductivity data via UART RS485 to external device. My external device have its own communication frame via RS485 so I modified the code to read the frame that is comming to CN0359 EC device and send the answer with conductivity data back.

Read function works perfectly but when I want to send data, on serial monitor I see that data is corrupted (lots of random ?|:&*^23##$). What is strange that in debug mode (via Jlink) the CN0359 EC meter send data perfectly without errors and I dont know why it happens. I have tried to block interrupts but without change. Source code below.source.zip



source code added
[edited by: KoRba88 at 10:33 AM (GMT 0) on 7 Dec 2018]