Skip to content

Wire and Wire1 are Swapped #1

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

Closed
mjs513 opened this issue Nov 27, 2024 · 8 comments
Closed

Wire and Wire1 are Swapped #1

mjs513 opened this issue Nov 27, 2024 · 8 comments

Comments

@mjs513
Copy link

mjs513 commented Nov 27, 2024

Describe the bug
Looks like Wire and Wire1 are swapped, please check this thread for more details:
https://forum.arduino.cc/t/i2c-experiments-with-zephyr-on-giga/1326321

this post in particular: https://forum.arduino.cc/t/i2c-experiments-with-zephyr-on-giga/1326321/6

Target board + cli verbose compilation output
Arduino GigaR1

Full verbose compilation output, ideally with arduino-cli invocation or from IDE 2.3.3+
Output.txt

Output of Serial Monitor
"Error initializing communication with IMU"

Output of readelf
You can find the loaction of the elf file by compiling in Verbose mode and looking near the end of the compilation output (after Linking everything together..)
Paste (or attach) the output of arm-none-eabi-readelf -a $your_sketch_elf_file

Optional: attach the elf file
LIS3DML_icm20649_bolderflight_libs.ino.zip

Optional: attach the sketch

Additional context
Runs under Giga1 Mbed no issues.

@mjs513
Copy link
Author

mjs513 commented Nov 28, 2024

@KurtE were digging some more into the way Zephyr works (see the referenced thread) and it appears that only one Wire port may be defined even though I don't see defined in the variants for the giga.

@mjs513
Copy link
Author

mjs513 commented Nov 28, 2024

Downloaded the current updates in the repository and Wire now seems to defined correctly to use the correct pins. However when I use the I2CScanner sketch and change to Wire1 I get an error message:

Compilation error: 'Wire1' was not declared in this scope; did you mean 'Wire'?

So kind of confirms only one Wire object is defined

@mjs513
Copy link
Author

mjs513 commented Nov 29, 2024

Just a quick update. Got it working by adding this to the giga m7 overlay file

&i2c1 {
	status = "disabled";
	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
	pinctrl-names = "default";
	clock-frequency = <I2C_BITRATE_FAST>;
};

&i2c2 {
	status = "disabled";
	pinctrl-0 = <&i2c2_scl_ph4 &i2c2_sda_pb11>;
	pinctrl-names = "default";
	clock-frequency = <I2C_BITRATE_FAST>;
};

and

i2cs = <&i2c2>, <&i2c4>, <&i2c1>;

Then running a modified Scanner (PJRC) was able to see wire and wire1

Scanning Wire...
Device found at address 0x1C  (LIS3MDL)
Device found at address 0x68  (DS1307,DS3231,MPU6050,MPU9050,MPU9250,ITG3200,ITG3701,LSM9DS0,L3G4200D)
done

Scanning Wire1...
Device found at address 0x60  (MPL3115,MCP4725,MCP4728,TEA5767,Si5351)
Device found at address 0x68  (DS1307,DS3231,MPU6050,MPU9050,MPU9250,ITG3200,ITG3701,LSM9DS0,L3G4200D)
Device found at address 0x76  (MS5607,MS5611,MS5637,BMP280)
done

@KurtE mentioned you might want to update your scanner for more than 1 wire object. Also might be convenient to define WIRE_INTERFACES_COUNT in Wire after the MACRO is called in Wire.h

Heres the sketch I am using for reference:
GIGA_SCANNER.zip

A big caveat. To get it to re-compile for the Giga Zephyr I had to put it into boot mode then it works otherwise still get a wire1 not defined

@facchinm
Copy link
Member

facchinm commented Dec 9, 2024

Hi @mjs513 ,
thanks for spotting! Do you mind providing a PR for the dts to preserve attribution 🙂 ? Thx!

@mjs513
Copy link
Author

mjs513 commented Dec 9, 2024

Morning @facchinm

PR just completed: Uodate Giga Overlay for I2c #3.

You might want to check the forum on the stuff that @KurtE and I have been commenting on with SPI with zephyr.

#3

and

https://forum.arduino.cc/t/mbed-zephyr-status-beta-by-end-of-year/1329083/10

@mjs513 mjs513 closed this as completed Dec 9, 2024
@facchinm
Copy link
Member

facchinm commented Dec 9, 2024

Yup, SPI checking is in my todo list for today, last time I tried with an sdcard shield everything was working but there might be issues between SPI/SPI1 (as in Wire)

@mjs513
Copy link
Author

mjs513 commented Dec 9, 2024

Yep we added a couple things the overlay for SPI based on @KurtE stuff:

&spi1 {
	status = "okay";
	pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pb3
		     &spi1_miso_pg9 &spi1_mosi_pd7>;
	pinctrl-names = "default";
};

&spi5 {
	status = "okay";
	pinctrl-0 = <&spi5_nss_pk1 &spi5_sck_ph6
		     &spi5_miso_pj11 &spi5_mosi_pj10>;
	pinctrl-names = "default";
};

and

spis = <&spi1>, <&spi5>;

think the diff is we specified spi5 instead of just saying ok.

EDIT:
SdFat lib is causing a the giga to hang with zephyr. @KurtE is having betting luck with the ILI9341.

@facchinm
Copy link
Member

facchinm commented Dec 9, 2024

I'll check the SDFat lib, let's move to another issue so we can properly keep track there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants