arduino - 将 SPI 的 SERCOM 引脚设置为 SAMD21 上的主设备的对立面不起作用
问题描述
我正在尝试使我的 SAMD21 芯片成为 SPI 从设备。
我有以下引脚:
- PB10 作为 MOSI
- PB11 作为 SCK
- PA10 作为 SS
- PA12 作为味噌
这些管脚大部分属于SERCOM4
但是,当我按如下方式设置引脚时,引脚无法正常工作:
PORT->Group[PORTB].PINCFG[10].bit.PMUXEN = 0x1; //Enable Peripheral Multiplexing for SERCOM4 SPI PA12 Arduino PIN22
PORT->Group[PORTA].PMUX[6].bit.PMUXE = 0x3; //SERCOM 4 is selected for peripheral use of this pad (0x3 selects peripheral function D: SERCOM-ALT)
PORT->Group[PORTB].PINCFG[11].bit.PMUXEN = 0x1; //Enable Peripheral Multiplexing for SERCOM4 SPI PB09 Arduino PIN16
PORT->Group[PORTB].PMUX[4].bit.PMUXO = 0x3; //SERCOM 4 is selected for peripheral use of this pad (0x3 selects peripheral function D: SERCOM-ALT)
PORT->Group[PORTA].PINCFG[10].bit.PMUXEN = 0x1; //Enable Peripheral Multiplexing for SERCOM4 SPI PB10 Arduino PIN23
PORT->Group[PORTB].PMUX[5].bit.PMUXE = 0x3; //SERCOM 4 is selected for peripheral use of this pad (0x3 selects peripheral function D: SERCOM-ALT)
PORT->Group[PORTA].PINCFG[12].bit.PMUXEN = 0x1; //Enable Peripheral Multiplexing for SERCOM4 SPI PB11 Arduino PIN24
PORT->Group[PORTB].PMUX[5].bit.PMUXO = 0x3; //SERCOM 4 is selected for peripheral use of this pad (0x3 selects peripheral function D: SERCOM-ALT)
我使用 https://github.com/lenvm/SercomSPISlave的库
我使用 arduino IDE 和 SAMD: M0 或其他东西 M0 Pro (navtive) 板布局对芯片进行编程。
根据文档的引脚:
- | 1 | 1 <- 德克萨斯 | PA10 | | EIC/EXTINT[10] ADC/AIN[18] PTC/X[2] *SERCOM0/PAD[2] TCC0/WO[2] TCC1/WO[0]
- | 22 | 1 | PA12 | 味噌 | EIC/EXTINT[12] SERCOM2/PAD[0] *SERCOM4/PAD[0] TCC2/WO[0] TCC0/WO[6]
- | 23 | 4 | PB10 | 莫西 | EIC/EXTINT[10] *SERCOM4/PAD[2] TC5/WO[0] TCC0/WO[4]
- | 24 | 3 | PB11 | SCK | EIC/EXTINT[11] *SERCOM4/PAD[3] TC5/WO[1] TCC0/WO[5]
解决方案
推荐阅读
- javascript - 在 JS 中使用可选的 java 变量
- python - 如何在 macOS Catalina 的 VS Code 中使用 pip install 安装依赖项
- android-studio - 詹金斯可以显示失败构建\成功构建的数量吗?
- javascript - 如何在 JavaScript 中进行模块论证?
- javascript - 如何在 reudx 中使用 mapdispatchtostate?
- amazon-web-services - 使用 step 函数运行多个 fargate 任务
- reactjs - 反应引导:导航栏最后一项右手定位
- mysql - 带有多个 IF 语句的 MySQL 触发器
- extentreports - 如何通过删除不需要的图形和额外空间来自定义范围报告
- javascript - 在 'Node' 上执行 'insertBefore' 失败:此节点类型不支持此方法