I2C SDA2 and SCL2 no success

External hardware connected to the STM32 board
Post Reply
Leplouc
Posts: 14
Joined: Fri Nov 10, 2017 12:31 pm
Location: Toulouse France

I2C SDA2 and SCL2 no success

Post by Leplouc » Sun Nov 12, 2017 9:29 am

My I2C(1) (PB6 and PB7) are used for my 8 bit TFT so I cant used them.
I tried in vain to use SDA2 and SCL2 (PB10/11) using HWire or SWire library.
A couple of topics talk about this point but nothing found..
Pse help.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: I2C SDA2 and SCL2 no success

Post by Pito » Sun Nov 12, 2017 9:42 am

Do write a small short sketch showing the issue and post it here such people may see it and help.
Pukao Hats Cleaning Services Ltd.

Leplouc
Posts: 14
Joined: Fri Nov 10, 2017 12:31 pm
Location: Toulouse France

Re: I2C SDA2 and SCL2 no success

Post by Leplouc » Sun Nov 12, 2017 10:16 am

That's the sketch :

Code: Select all

//////////////////////////////////////////////////////////////////////////////
//       Copyright©2016.JA2GQP.All rights reserved.
//            si5351a PLL test        
//                                                    2017/5/20
//                                                    JA2GQP     
//---------------------------------------------------------------------------
//       stm32f103               si5351a             Arduino nano(UNO)
//         PB6(SCL1)    ------     SCL     ------          A5
//         PB7(SDA1)    ------     SDA     ------          A4
//         3V3(3.3V)    ------     VIN     ------          5V
//         GND          ------     GND     ------          GND
//////////////////////////////////////////////////////////////////////////////

//---------- include Files ---------------

#include "si5351a2.h"
#include <Wire.h>
HardWire HWire(1, I2C_FAST_MODE); // I2c1   
//Using (1, I2C_FAST_MODE); PB6/SCL1 and PB7/SDA1 are working
//Using (2, I2C_FAST_MODE;  PB10/SCL2 and PB11/SDA2 are not working
//----------  Initialization  Program  ----------------------

void setup() {
  HWire.begin(2);                   

  Si5351_write(XTAL_LOAD_C,0x80);       //Crystal Load Capasitance=8pF

  si5351aSetFrequency(100000L);        //CLK0 
  si5351aSetFrequency2(8000L);       //CLK2
}

//----------  Main program  ---------------------------------
 
void loop() {
}

Leplouc
Posts: 14
Joined: Fri Nov 10, 2017 12:31 pm
Location: Toulouse France

Re: I2C SDA2 and SCL2 no success

Post by Leplouc » Sun Nov 12, 2017 10:18 am

Pse read HWire.begin() instead of HWire.begin(2)

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: I2C SDA2 and SCL2 no success

Post by Pito » Sun Nov 12, 2017 12:33 pm

FYI: You may edit your posts anytime and freely after the posting by clicking on the "pencil" icon. Also you may delete it with the cross icon (for some time from posting).
Also paste your source code such you click on </> icon while in editor and paste the source inside..
source code.JPG
source code.JPG (9.76 KiB) Viewed 177 times

Code: Select all

my code here
Pukao Hats Cleaning Services Ltd.

Leplouc
Posts: 14
Joined: Fri Nov 10, 2017 12:31 pm
Location: Toulouse France

Re: I2C SDA2 and SCL2 no success

Post by Leplouc » Sun Nov 12, 2017 12:41 pm

Tks Pito,
I'm quite new on the forum...

User avatar
RogerClark
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: I2C SDA2 and SCL2 no success

Post by RogerClark » Sun Nov 12, 2017 7:06 pm

Post a link to the library.

BTW.debugging issues like this normally need a logic analyser, luckily you can get a usb based 8 channel 24mhz logic analyser for around $10

Leplouc
Posts: 14
Joined: Fri Nov 10, 2017 12:31 pm
Location: Toulouse France

Re: I2C SDA2 and SCL2 no success

Post by Leplouc » Mon Nov 13, 2017 5:17 am

I guess Hardwire is included in the Wire lib.
If I remove the TFT, my I2C board (Si5351) works perfectly with SDA1/SCL1 but no com with SDA2/SCL2.

Post Reply