Altera_Forum
Honored Contributor
17 years agohelp: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?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?What function did you add to your interrupt routine? We could try guessing but a bit more information might help us get there quicker.
hi,
it's a function to deal with the data received by uart.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.
hi,
yeah, in the function, i used "alt_write_flash() & alt_read_flash()".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.
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?
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.