收到版主送的 Seeeduino 板子,挺精致。仅一点点不完美。-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3124|回复: 2

[讨论] 收到版主送的 Seeeduino 板子,挺精致。仅一点点不完美。

[复制链接]
发表于 2018-12-14 13:13 | 显示全部楼层 |阅读模式
本帖最后由 skypup 于 2018-12-14 13:28 编辑

白色的 4 针接口,分别是: TTL, I2C, I2C
另有单独的串口焊盘,线序:VCC, RX, TX, RTS, GND
串口转TTL使用的是 Mega16U2.

08 - 副本.jpg
背面的信息:
版本 v4.2 2015年05月22日
网址:www.seeedstudio.com (能访问,是一个英文网站.)
13 - 副本.jpg

包装盒上的 studio 小写,印的很清楚。这个细节可以拉开档次。
02 - 副本.jpg

请 100% 比例查看原图,可以看到印刷的网纹,还是挺精致的,这又是一个加分项。
07 - 副本.jpg

芯片的焊点,比较漂亮。
10 - 副本.jpg


============================================================
下面说瑕疵。
借助放大镜,找到了一些瑕疵,这个贴子只说2处。

把图片放大 100%,仔细看字母 s 和 e,可以看到边缘有可以分辨出的锯齿。
如果不借助放大镜,只是肉眼观察的话,仔细分辨是能感觉到字母的边缘似乎的确有一点点不圆润。
06 - 副本.jpg

丝印的白色圆圈与焊盘不同心。肉眼可见。
15 - 副本.jpg





 楼主| 发表于 2018-12-14 22:11 | 显示全部楼层
Arduino UNO 官方版本存在一个硬件兼容性小问题。
如果使用的是官方或兼容硬件(如:Seeeduino),在 57600 波特率下,恰好重写了串口中断,可能会不幸中招。
1 使用 57600 波特率。
2 重写了硬件串口的代码,而又没有对 57600 波特率做特别处理。

Arduino 给出的说明:

  // hardcoded exception for compatibility with the bootloader shipped
  // with the Duemilanove and previous boards and the firmware on the 8U2
  // on the Uno and Mega 2560.


举个例子,我的解决方法如下。
有问题的代码:
void SerialOpen(uint8_t port, uint32_t baud) {
  uint8_t h = ((F_CPU  / 4 / baud -1) / 2) >> 8;
  uint8_t l = ((F_CPU  / 4 / baud -1) / 2);
  switch (port) {
    #if defined(PROMINI)
      case 0: UCSR0A  = (1<<U2X0); UBRR0H = h; UBRR0L = l; UCSR0B |= (1<<RXEN0)|(1<<TXEN0)|(1<<RXCIE0); break;
    #endif
    #if defined(PROMICRO)
      #if (ARDUINO >= 100) && !defined(TEENSY20)
        case 0: UDIEN &= ~(1<<SOFE); break;// disable the USB frame interrupt of arduino (it causes strong jitter and we dont need it)
      #endif
      case 1: UCSR1A  = (1<<U2X1); UBRR1H = h; UBRR1L = l; UCSR1B |= (1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1); break;
    #endif
    #if defined(MEGA)
      case 0: UCSR0A  = (1<<U2X0); UBRR0H = h; UBRR0L = l; UCSR0B |= (1<<RXEN0)|(1<<TXEN0)|(1<<RXCIE0); break;
      case 1: UCSR1A  = (1<<U2X1); UBRR1H = h; UBRR1L = l; UCSR1B |= (1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1); break;
      case 2: UCSR2A  = (1<<U2X2); UBRR2H = h; UBRR2L = l; UCSR2B |= (1<<RXEN2)|(1<<TXEN2)|(1<<RXCIE2); break;
      case 3: UCSR3A  = (1<<U2X3); UBRR3H = h; UBRR3L = l; UCSR3B |= (1<<RXEN3)|(1<<TXEN3)|(1<<RXCIE3); break;
    #endif
  }
}

修改为:

void SerialOpenUNO(uint32_t baud)
{
  uint16_t baud_setting;
  bool use_u2x = true;

#if F_CPU == 16000000UL
  if (baud == 57600)
  {
    use_u2x = false;
  }
#endif

try_again:

  if (use_u2x)
  {
    UCSR0A  = (1<<U2X0);
    baud_setting = ((F_CPU  / 4 / baud -1) / 2);
  }
  else
  {
    UCSR0A  = 0;
    baud_setting = ((F_CPU  / 8 / baud -1) / 2);
  }

  if ((baud_setting > 4095) && use_u2x)
  {
    use_u2x = false;
    goto try_again;
  }

  uint8_t h = ((F_CPU  / 4 / baud -1) / 2) >> 8;
  uint8_t l = ((F_CPU  / 4 / baud -1) / 2);

  UBRR0H = baud_setting >> 8;
  UBRR0L = baud_setting;
  UCSR0B |= (1<<RXEN0)|(1<<TXEN0)|(1<<RXCIE0);
}

void SerialOpen(uint8_t port, uint32_t baud) {
#if defined(PROMINI)
  SerialOpenUNO(baud);
#else
  uint8_t h = ((F_CPU  / 4 / baud -1) / 2) >> 8;
  uint8_t l = ((F_CPU  / 4 / baud -1) / 2);
  switch (port) {
//    #if defined(PROMINI)
//      case 0: UCSR0A  = (1<<U2X0); UBRR0H = h; UBRR0L = l; UCSR0B |= (1<<RXEN0)|(1<<TXEN0)|(1<<RXCIE0); break;
//    #endif
    #if defined(PROMICRO)
      #if (ARDUINO >= 100) && !defined(TEENSY20)
        case 0: UDIEN &= ~(1<<SOFE); break;// disable the USB frame interrupt of arduino (it causes strong jitter and we dont need it)
      #endif
      case 1: UCSR1A  = (1<<U2X1); UBRR1H = h; UBRR1L = l; UCSR1B |= (1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1); break;
    #endif
    #if defined(MEGA)
      case 0: UCSR0A  = (1<<U2X0); UBRR0H = h; UBRR0L = l; UCSR0B |= (1<<RXEN0)|(1<<TXEN0)|(1<<RXCIE0); break;
      case 1: UCSR1A  = (1<<U2X1); UBRR1H = h; UBRR1L = l; UCSR1B |= (1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1); break;
      case 2: UCSR2A  = (1<<U2X2); UBRR2H = h; UBRR2L = l; UCSR2B |= (1<<RXEN2)|(1<<TXEN2)|(1<<RXCIE2); break;
      case 3: UCSR3A  = (1<<U2X3); UBRR3H = h; UBRR3L = l; UCSR3B |= (1<<RXEN3)|(1<<TXEN3)|(1<<RXCIE3); break;
    #endif
  }
#endif  
}

发表于 2019-7-23 07:25 | 显示全部楼层
别的话我都不听,这个板子好漂亮
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-9-20 22:48 , Processed in 0.110227 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表