Hi Rob, Are you using a PIC16*LF*18325 ? If so, beware that there is a hardware bug (in all hardware revisions except the last one) in the MSSP module when using the PIC with a VDD > 3 V See §6.2 in Errata here <https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/Errata/PIC16-L-F18325-18345-Silicon-Errata-Data-Sheet-Clarification-DS80000668.pdf>
Thanks for i2c_harware2.jal, but what about the other files ? Do you intent to duplicate them also, or do you want I do it (with the right naming convention this time) ? Le samedi 29 mars 2025 à 11:37:18 UTC+1, Rob CJ a écrit : > Hi David, > > I uploaded the i2c_hardware2.jal library to GitHub including sample files > for 16f18325 and 16f18425 both for i2c_hardware.jal and i2c_hardware2.jal. > All sample files have been tested. > > So they will be in the next bee-package. > > Kind regards, > > Rob > > ------------------------------ > *Van:* [email protected] <[email protected]> namens > [email protected] <[email protected]> > *Verzonden:* vrijdag 28 maart 2025 20:18 > > *Aan:* jallib <[email protected]> > *Onderwerp:* Re: [jallib] Two I2C Bus on one PIC > You can use PPS to reassign TX, just to be sure > > Télécharger BlueMail pour Android <https://bluemail.me> > Le 28 mars 2025, à 19:15, Rob CJ <[email protected]> a écrit: > > 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]. > 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 > > <https://groups.google.com/d/msgid/jallib/VI1PR02MB611174411ACB7EE1A309ADFAE6A02%40VI1PR02MB6111.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]. > To view this discussion visit > https://groups.google.com/d/msgid/jallib/9170a052-3774-4d24-8e44-44b0e17d8326%40gmail.com > > <https://groups.google.com/d/msgid/jallib/9170a052-3774-4d24-8e44-44b0e17d8326%40gmail.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/f4cce63c-5dc7-4584-bbea-5e7cb0a272fdn%40googlegroups.com.
