Hi David, Thanks for the hint. I tried it but it does not work.
Reason for not using the default is because I am also using the serial port and that one is on C4. But in the case of the sample program with the SSD1306 and EEPROM I can use the defaults. I will give that a try. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens David VB <[email protected]> Verzonden: vrijdag 28 maart 2025 14:10 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] Two I2C Bus on one PIC With your PPS code, you only assign outputs. The PPS requires you to also configure the inputs on the same pins for I2C In your case: RC0PPS = PPS_SCK1 RC1PPS = PPS_SDA1 SSP1CLKPPS = PPS_RC0 SSP1DATPPS = PPS_RC1 But why not keep it simple and use the default pins ? SCL1 = RC0 SDA1 = RC1 SCL2 = RC4 SDA2 = RC5 Le vendredi 28 mars 2025 à 12:57:12 UTC+1, Rob CJ a écrit : Hi David, Short update. I used the original I2C harware library and changed the names differntly so that it matches with the conventions that are also used for other libraries. So i2c_intialize() is called i2c_initialize2(), etc. I also cleaned up the library a bit. I made a sample program that uses both i2c interfaces at the same time. I connected an SSD1306 display to the first IIC bus and an I2C EEPROM to the second IIC bus. In this way I am sure that I can use both interfaces at the same time. And now the bad news. I did not get the second IIC inteface working. So I did an extra test by only controlling one device first with first IIC library and then did the same with the second IIC library by using exactly the same pins but still the second IIC does not want to work. In both cases I had set the PPS pins which is required for the IIC to work. So for the first test: RC0PPS = PPS_SCK1 RC1PPS = PPS_SDA1 and for the second test: RC0PPS = PPS_SCK2 RC1PPS = PPS_SDA2 Since I have no clue yet I posted the issue on the Microchip Forum to see if somebody knows about this problem. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Rob CJ <[email protected]> Verzonden: woensdag 26 maart 2025 18:57 Aan: [email protected] <[email protected]> Onderwerp: Re: [jallib] Two I2C Bus on one PIC Hi David, It could be that renaming is sufficient but for that I need to dive a little deeper in the PIC16F18325. You can give it a try but I might work on it later too. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens David VB <[email protected]> Verzonden: woensdag 26 maart 2025 17:52 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] Two I2C Bus on one PIC The second bus will connect devices that will not always be present or powered up. I don't want to take the risk to hang the whole main bus if those devices are not attached. And since there are two MSSP in the PIC, it's worth to use them. Rob, If it this as I described (only copy and rename the registers/variables/constants by adding a '2' as needed, if you want, I can do it myself and share it later on). I was planning to use also the i2c_level1.jal and i2c_reset_bus.jal libraries. Therefore, I think this will need 3 new (copies) files. Le mercredi 26 mars 2025 à 17:25:08 UTC+1, Rob CJ a écrit : Hi David, I think that, just as for the serial hardware, that we need a second iic hardware library. I could make the library for you and start this weekend. I think that it is not that much work. Met vriendelijke groet, Rob Jansen ________________________________ From: [email protected] <[email protected]> on behalf of David VB <[email protected]> Sent: Wednesday, March 26, 2025 4:23:18 PM To: jallib <[email protected]> Subject: [jallib] Two I2C Bus on one PIC Hi, I will use a PIC16F18325 to control (as master) TWO separate I2C Buses. This PIC has 2 MSSP modules, so this is possible. But, the I2c_hardware.jal lib does not support that: it can only reference the first module. o i have to make a copy of that lib, and rename all references to the registers of the MSSP module to access the second module ? (Ex: SSPCON2 which is an alias for SSP1CON2 should be renamed SSP2CON2 in the copy of the lib) Or is there another way ? Also note that if I want to make the buses run at different speeds (ex: one at 100 kHz, and one at 400 kHz), some global variables and constants have also to be duplicated and renamed. Any ideas welcome.... Kind regards, David -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/6d8d86fb-7d51-4b8a-93a2-fc2244d36da6n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/6d8d86fb-7d51-4b8a-93a2-fc2244d36da6n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/94c59e9a-4b96-4f75-b58b-127bd60211den%40googlegroups.com<https://groups.google.com/d/msgid/jallib/94c59e9a-4b96-4f75-b58b-127bd60211den%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/AM7PR02MB6098960E74D00999EEC7F56BE6A62%40AM7PR02MB6098.eurprd02.prod.outlook.com<https://groups.google.com/d/msgid/jallib/AM7PR02MB6098960E74D00999EEC7F56BE6A62%40AM7PR02MB6098.eurprd02.prod.outlook.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion visit https://groups.google.com/d/msgid/jallib/87513abe-16e1-4130-9ec9-0ea9ad922a5an%40googlegroups.com<https://groups.google.com/d/msgid/jallib/87513abe-16e1-4130-9ec9-0ea9ad922a5an%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/jallib/VI1PR02MB611174411ACB7EE1A309ADFAE6A02%40VI1PR02MB6111.eurprd02.prod.outlook.com.
