- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello!i want to receive data from uart1 every 3 sec,i use the time alarm,the data send 1 sec every time,but i found that the data missing seriously! for examle:the rigth data should be:123456789 but i received from the uart1 is:13579,the band is 4800 and it can't be changed !why?help!
the programm is below:# include <stdio.h># include <string.h># include <unistd.h># include "system.h"# include "alt_types.h"# include "sys/alt_alarm.h"# include "altera_avalon_uart_regs.h" static alt_alarm alarm1; alt_u32 my_alarm(void *content) {int i; char rd; char *rc1; printf("it is timer\n"); do { rd=IORD_ALTERA_AVALON_UART_RXDATA(UART1_BASE); } while(rd!='$'); IOWR_ALTERA_AVALON_UART_TXDATA(UART1_BASE, rd); printf("receive:%c\n",rd); for(i=0;i<50;i++) { rd=IORD_ALTERA_AVALON_UART_RXDATA(UART1_BASE); rc1=rd;
}
for(i=0;i<50;i++)
printf("%c",rc1); printf("\n"); return 3*alt_ticks_per_second(); } int main() { if(alt_alarm_start(&alarm1,1000,my_alarm,NULL)<0) printf("it is error!\n"); }
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please look at P4-7 P4-8 in Nios II SW handbook (n2sw_nii5v2.pdf)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you for your answer! yes i see,but time alarms like ISRs run in a restricted environment.for example:accesses to the HAL file system are not permitted. what's your meaning?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page