Forum Discussion
help:uart error
hi,
i used the uart correctly before, but when i added a function in the uart interrupt function, it can receive the data only once, receiveed another data, the program run out. why?7 Replies
- Altera_Forum
Honored Contributor
It seems likely that during flash write operations, interrupts could be disabled for relatively long periods (I'm just guessing, I haven't checked). You could therefore get uart buffer overrun errors and lose data.
Without a lot more information about your code, it's hard to make any useful suggestions. - Altera_Forum
Honored Contributor
i have tried to call programme in other location, and i set a flag in the usart isr. the main programme checked the flag, and called programme. then the same problem happened.so why?
- Altera_Forum
Honored Contributor
Well according to the literature, neither of those functions should be used in an ISR. I think you need to restructure your code to make the ISR function much simpler.
- Altera_Forum
Honored Contributor
hi,
yeah, in the function, i used "alt_write_flash() & alt_read_flash()". - Altera_Forum
Honored Contributor
Fair enough. Well there's nothing intrinsically wrong with calling a function from within an ISR. The most likely problem is that you are using a HAL function call which relies on interrupts being enabled.
- Altera_Forum
Honored Contributor
hi,
it's a function to deal with the data received by uart. - Altera_Forum
Honored Contributor
What function did you add to your interrupt routine? We could try guessing but a bit more information might help us get there quicker.