Forum Discussion
Altera_Forum
Honored Contributor
10 years agoUART using NIOS II
Hi again, I already posted a topic about nios ii altera ans esp8266, I fixed all my problems with the esp8266, now i still struggling with my uart C code, my transmit function works well, but wit...
Altera_Forum
Honored Contributor
10 years agoHello Ayelha,
I do not completely understand what you are trying to do. But, assuming you will be running the main function multiple times, as you say it, you might have to do with a memory leak: every time you circle through the main function, you allocate 200 bytes from the heap. It is good practice to release these bytes (malloc - free). If you do not to this, you could run out of memory after a while. Then you will get unstable program behaviour. Some other thing you might want to take a look at: in Your send function, there could be an error: if you want to test a flag in a register use ((value & mask) = mask) i do have the impression that you have written something else. This would explain while you need a delay in your function where as, under normal circumstances, you do need wait functions if you are using the status flags of the uart. Wait functions are not good for optimal performance and baudrate independency. Best Regards, Johi.