- 积分
- 3
贡献25
飞刀2 FD
注册时间2016-10-12
在线时间0 小时
扫一扫,手机访问本帖
|
OK6410串口的扩展串口不能使用,具体程序如下,系统中有节点ttySAC0,ttySAC1,ttySAC2,ttySAC3。ttySAC0为控制台,其中char *dev = "/dev/ttySAC0"; 的时候串口0可以发送数据PC能收到,但char *dev = "/dev/ttySAC1",char *dev = "/dev/ttySAC2",char *dev = "/dev/ttySAC3",的时候通过串口1,2,3PC收不到数据,除了新买的开发板里面电路好坏不能确定外,自己做的扩展电路没有问题。请大家帮忙找下问题,谢谢
int main(void){
int fd;
int nread,nwrite,count=0;
char tempbuff[13];
char *buff="you did it\n";
char *dev = "/dev/ttySAC2";
printf("open ttySAC0\n");
fd = OpenDev(dev);
printf("%d\n",fd);
// printf("%fd\n",$fd);
printf("set speed\n");
set_speed(fd,115200);
printf("set parity\n");
if (set_Parity(fd,8,1,'N') == FALSE)
{
printf("Set Parity Error\n");
}
while (1)
{
printf("write data to tty1\n");
if((nwrite=write(fd,buff,strlen(buff)))<0)
{
printf("uart send Error\n");
}
printf("%d\n",nwrite);
sleep(5);
}
close(fd);
}
while (1)
{
printf("write data to tty1\n");
if((nwrite=write(fd,buff,strlen(buff)))<0)
{
printf("uart send Error\n");
}
printf("%d\n",nwrite);
sleep(5);
}
close(fd); |
|