New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SERCOM I2C not working on pins PA08, PA09 #383
Comments
Hi @garageeks ,
|
Heads up - I imagine that'll solve your problem. But I'm running into my own problem using the alternate SERCOM on those pins, but in slave mode. It seems that "onRequestCallback" always gets handled before "onReceiveCallback" in situations where a write happens quickly before a read for the sake of setting an address. I'm curious, therefore, if you've run into any oddities using i2c on those pins. |
Dear @facchinm , apologies for the enormous delay, had to resume this project now.
I have tried using sercom2 alternate mode as per instructions, it still freezes. Unfortunately this is the only SAMD21 board I currently have, could you please try to use a I2C device on pins PA08, PA09 on a Arduino Zero? Maybe the bug is in the SparkFun definitions. |
I have used this software bit-bang I2C emulation library on pins PA08, PA09 and works fine I don't see any issues hardware-wise, could be some wrong SERCOM initialization? |
I'm not convinced it's related at all, but here's a corroborated issue for I2C slave mode failing. Seems sercom/pin independent, in that case. |
I am using PA08 and PA09 for I2C. I have not noticed any problems at this point. |
I should mention that I did come across a problem with the I2C stop bit timing where the stop bit is suppressed if you go to sleep right away. This issue is independent of which sercom port I am using. |
@sslupsky thank you for your feedback. I'm not using sleep at the moment. |
@alexwhittemore you're right in saying that PA08 is the only pin on the MCU with a non-maskable interrupt. Maybe is this the issue? |
Got the ATMEL ICE and currently debugging a sample sketch on Atmel Studio. The funny fact is that this function is called by this instruction in Wire.cpp, line 124, function endTransmission: Why startTransmissionWIRE is called with address 63 and then is working on address 126? Anyway, I still to wrap my head on this, if you can point into which direction to see, ATMEL Studio debugger is powerful. I can report the status of the SERCOM registers for instance. Here's the stack trace
Here is the sketch code. Standard I2C on pins A4, A5 works fine and it is used to control a MCP23008 I2C expander. ` #define ioRightLedPin 7 TwoWire Wire1(&sercom0, 4, 3); //I2C expander library init LiquidCrystal_I2C lcd(0x3F,16,2); // this is a large buffer for replies void SERCOM4_Handler() void setup() { SerialUSB.begin(115200); mcp.begin(); intI2Cscanner(); // Print a message to the LCD. void loop () { // read from port 0, send to port 1: void intI2Cscanner() { SerialUSB.println(F("Int I2C Scanning...")); nDevices = 0;
} }` |
That is true, but I'm pretty certain it's not the issue, since Chris over on that other issue I linked reproduced the problem on a different set of pins neither of which have NMI on them. Our issues may be completely unrelated, and likely are. I came here because the pins are the same and yours was one of the first existing issues I found, but the overlap may end there. |
@facchinm Dear Martino, the issue is still ongoing, I tried different boards, different SW releases, but I cannot make I2C work on pins PA08, PA09, both SERCOM0 and SERCOM2_ALT won't work. @sslupsky you have it working, could you please share which board are you using, and which board version in the Arduino IDE are you using? If you have a sample code to try, it would be awesome. |
I am using the MKR WAN 1300 and 1310. I will dig up my initialization and post it. |
Hi @garageeks I checked my configuration and for that interface I am using the default configuration for the board I am using (MKR WAN 1300 and 1310). These variants specify that PA08/PA09 are assigned to the TwoWire interface "Wire" using SERCOM2. Here is a snippet from the variant.h for the MKR WAN 1300:
Have you got pull up resistors on those pins? The Sparkfun Mini board does not have pull ups so you need to add them or ensure that the board you are using has them and they are connected. |
I am getting the same issue using PA08 and PA09 on the ATSAMD21G18A-AU with an Arduino Zero bootloader on a custom PCB.--I2C Scanner does not work though. |
Hardware platform: Sparkfun SAMD21 Mini Breakout + BME280 sensor + VL53L0X sensor
Software platform: Arduino 1.8.3, Arduino SAMD Boards 1.6.20, Sparkfun SAMD21 boards 1.5.3, Windows 10 Pro 1803
Aim:
Result:
Steps to reproduce:
The text was updated successfully, but these errors were encountered: