![]() |
Forum Index : Microcontroller and PC projects : I2C should be easy...
Author | Message | ||||
pwillard Guru ![]() Joined: 07/06/2022 Location: United StatesPosts: 313 |
You know... for the uninitiated... I2C is somewhat painful. I'm looking at the Sparkfun QWIIC MP3 Trigger. (thinking I can save some time and effort coding since it is a standalone Mp3 PLAYER from its own SDCARD) Truth is... not so... SO I'm reading their page... I can see the device shows up at &H37 with the I2C scanner... but the DOCS and examples say WRITES are &H6E and READS are &H6F so its using that "shifted I2C" stuff. Ok, I can try to deal with that... So... after I2C OPEN 100,200 I send "I2C write &H6E,0,2,&H01,&H01" a supposedly valid command to start playing track 1 but... I only get... And I don't know why? When I right to &H37... I looks different... still doesn't work. Edited 2022-06-30 04:23 by pwillard |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
I2C is silly in this respect the 7-bit address i.e. 37 is actually the left most 7 bits. The LSB is actually the read/write bit. In your example just use &H37 for both read and write and the H/W actually appends the correct LSB |
||||
pwillard Guru ![]() Joined: 07/06/2022 Location: United StatesPosts: 313 |
Agree... its silly... and for me... hard to understand |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Your second trace looks completely correct. The I2C command has transferred properly. There may be other initialisation you need to do (set volume?) To confirm the command is working check MM.I2C after the write command Edited 2022-06-30 04:32 by matherp |
||||
pwillard Guru ![]() Joined: 07/06/2022 Location: United StatesPosts: 313 |
I'm looking at their trace on this page: Sparkfun page and it clearly shows they send a &H6E... which had me scratching my head. (Still didn't seem to work though) More experiments are needed. |
||||
pwillard Guru ![]() Joined: 07/06/2022 Location: United StatesPosts: 313 |
And then just like that... it actually started working. Led astray by the examples. And yes, apparently one of my tests set volume to 0 Edited 2022-06-30 04:56 by pwillard |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
If it makes you feel any better, I2C confused the hell out of me when I was learning it also. Addressing was part of it(the R/W bit issue you were having), but I was using EEPROM chips, and I kept overwriting the page boundary, which is a big no-no with those I2C memory chips, so I would corrupt data. Once I taught myself how pages work with the help of the members here, or simply make sure that any record written to the memory ALWAYS started from byte-0 of page X, my problems went away, but I was quite lost with I2C at the beginning and thought I would never make it work. I still do have the occasional hiccup with those devices, but once you get the hang of it, it tends to make sense and become more plain sailing. ![]() Edited 2022-06-30 14:48 by Grogster Smoke makes things work. When the smoke gets out, it stops! |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
Every connection has things that often go wrong.... I2C -> 7 -or- 8 bit addressing (or 10bit...) RS232 -> RX/TX swaps SPI -> clock edge, DI/DO swaps "Chinese" I2C -> always something behaves not I2C. Some I2C LCD's, TM1637, etc... Anyway, you solved it.. Success ! Edited 2022-06-30 17:09 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
pwillard Guru ![]() Joined: 07/06/2022 Location: United StatesPosts: 313 |
Well, this was actually the first time I encountered "shifted I2C" references... but their mention to use &H6E and &H6F was a complete red herring. Following my gut and using the address that the I2C scanner returned was the answer. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |