Looking the schematic of the board MKRWiFi1010 i see some port of the processor connected to expansion connector and also to NINA W-102 and Crypto chip.
The lines PA08, PA09 (I2C bus) and PB22 and PB23 (Serial1) are connected to NINA and to expansion connector.
As I have already reported in another post there is activity on 14-Tx, so can I use Serial1 on this line? Or there is the risk of interfering with NINA?
Am I free to use I2C bus (11-SDA 12-SCL) to implement a slave peripheral?
Or there is the risk of interfering with NINA or Crypto chip?
Thanks
Livio
I had very similar questions recently. After spending a considerable amount of time on research about this and diving deep into the SAMD21 microchip architecture I feel like I should be able to answer some of your questions.
As you noticed, some of the pins are connected to the WiFi module. In particular PB22 and PB23, which are the default UART Interface Serial1 and PA08 and PA09 which are connected to the ECC unit.
You also noticed that there is some activity on Serial1 when using the WiFi. I'm not sure whether you can still use it while using the WiFi.
However this isn't necessary. You can "simply" define a new Serial interface on different pins!
The SAMD21 Chip has 6 Sercom units for Serial communication. Each of these can be configured for UART, I2C or SPI on certain pins. The default configuration of the MKR WiFi 1010 is the following:
Sercom1: SPI on pins PA16,17,19
Sercom2: I2C on pins PA08, 09
Sercom5: UART on pins PB22, 23 (Serial1)
Sercom4: Something WiFi specific on pins PA12,13,14,15 which are not acessible from the outside. (This interface is also called Serial2)
Of course one can also find informations directly in the 1200 page documentation of the SAMD21
Important to know is that each Sercom unit can only be used with a few specific pins and one needs to "mux it up" correctly.
This is shown in the detailed Pinout diagram. For example for pins PA10 and PA11 we can either use Sercom0 (Pads 2 and 3) or Sercom2 (alternative pads 2 and 3)
The code for creating an additional UART interface called Serial_c0 with Sercom0 on these pins looks the following:
#include <Arduino.h>
#include <wiring_private.h>
// Serial_c0 pin and pad definitions
#define PIN_SERIAL_c0_TX (2ul) // Pin description number for PIO_SERCOM on D2
#define PIN_SERIAL_c0_RX (3ul) // Pin description number for PIO_SERCOM on D3
#define PAD_SERIAL_c0_TX (UART_TX_PAD_2) // SERCOM pad 2 TX
#define PAD_SERIAL_c0_RX (SERCOM_RX_PAD_3) // SERCOM pad 3 RX
Uart Serial_c0(&sercom0, PIN_SERIAL_c0_RX, PIN_SERIAL_c0_TX, PAD_SERIAL_c0_RX, PAD_SERIAL_c0_TX);
void SERCOM0_Handler() // Interrupt handler for SERCOM0
{
Serial_c0.IrqHandler();
}
void Setup(){
pinPeripheral(2, PIO_SERCOM); //Sercom Multiplexing
pinPeripheral(3, PIO_SERCOM); //for alternative pads, PIO_SERCOM_ALT has to be used
}
If you want to create additional I2C or SPI Interfaces you can find examples in the links above.
For my application, I needed a total of 4 UART interfaces as well as the WiFi, so I used Sercom0 and 3 and also Sercom1 and 2 (converting the default SPI and I2C to UART). This works nicely and the WiFi is still functional.
I hope this can help you and maybe even a few other people. This knowledge seems to be not that wide spread as you received no response in more than 1.5 months.