• AVR Freaks

AnsweredHot!simultaneous work PIC16F18346 in master and slave mode

Author
BUVA
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2018/08/29 11:31:18
  • Location: 0
  • Status: offline
2020/02/21 05:17:26 (permalink)
0

simultaneous work PIC16F18346 in master and slave mode

Simultaneous work in master and slave mode. One module is configured in master mode I2C the second peripheral module is configured in slave mode I2C with device address 0x01. The findings of both channels are connected to one bus I2C. The master’s appeal to an additional device at 0x00 is not. I configure PIC16F18345 with separate buses. The option device is not responding. If you enable only one of the peripheral modules in the mode MASTER, everything works. Optional device responds. They work in MULTIMASTER mode. But the MASTER and SLAVE do not want to. This problem is not solved or I have errors.
#1
pcbbc
Super Member
  • Total Posts : 1691
  • Reward points : 0
  • Joined: 2014/03/27 07:04:41
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 10:51:04 (permalink)
+3 (3)
BUVAThis problem is not solved or I have errors.

Yes, that is indeed correct.
 
And your problem is very unlikely to get solved unless you post some code...
#2
Gort2015
Klaatu Barada Nikto
  • Total Posts : 3845
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 13:24:27 (permalink) ☼ Best Answerby BUVA 2020/02/21 15:57:39
+3 (3)
Address 0 is common to all i2c devices - they all get the message.
Address 1 is illegal.
 
Got to go out.

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#3
ric
Super Member
  • Total Posts : 27071
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 13:57:20 (permalink)
+1 (1)
What he said.
You simply cannot design a whole I2C system if you don't understand the fundamentals of I2C.
Start at https://en.wikipedia.org/wiki/I%C2%B2C
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
BUVA
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2018/08/29 11:31:18
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 15:48:21 (permalink)
0
PIC16F18346 If I use only one peripheral module with i2c in MASTER mode, I successfully transfer data to an additional device. As soon as I configure the second peripheral module through the MCC in the SLAVE ADDRESS 0X01 mode, the data is no longer transmitted. More precisely, the additional device does not respond. MPLAB X v5.30 and Microchip Code Configurator v 3.95
post edited by BUVA - 2020/02/21 15:55:30
#5
Mysil
Super Member
  • Total Posts : 3670
  • Reward points : 0
  • Joined: 2012/07/01 04:19:50
  • Location: Norway
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 18:03:39 (permalink)
0 (2)
Hi,
I2C device addresses ( 7 bit addresses) from 0 thru 7 and 120 thru 127 are reserved for special purposes,
and should Not be used for device addressing.
I2C address 0 is General Call, it is a broadcast address, with special protocol.
 
    Mysil
#6
Gort2015
Klaatu Barada Nikto
  • Total Posts : 3845
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 20:11:59 (permalink)
-1 (1)
Strick mode can be disabled to allow the reserved range.
The slave general call can be disabled.
 
(If those options are not there then keep to strict rules)
 
The i2c slave code should be executed inside interrupts, a sequence of events.
(State Machine to some)
 
Do you know what the slave device should respond with after receiving a message from the master and the actions of this?

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#7
Gort2015
Klaatu Barada Nikto
  • Total Posts : 3845
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/21 20:18:52 (permalink)
0 (2)
A general call is normally used as a reset message to all slave devices and these slaves can not respond back.
 

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#8
BUVA
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2018/08/29 11:31:18
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/22 02:15:43 (permalink)
0
Thank you for wanting to help, but I'm not asking for reserved addresses or for what the slave does and not for the I2C protocol, etc. with regards to the tire. Question with regards to the code and the microcontroller.
Question. Can both MSSP modules work in peak 16f18346 simultaneously on the same bus I2C MSSP1 master, and MSSP2 slave. If this is not possible (which would be strange) there are no questions.
In the project I use MPLAB 5.30 and MCC 3.95 for PIC16F18346
1. Configuring MSSP1 in the master.
2. I send to the additional device at the correct slave address.
3 slave accepts, answers, the master does not freeze. ALL OK.
4 Using MCC I add MSSP2 to the slave mode. (it doesn’t matter on one bus or not, it doesn’t matter which address I specify). Just added and without changing the default, or changing the settings, changing the PINs of the SCL and SDA.
5. I compile, I am flashing already on the dominating slave device there is no reaction.
 
I take PROTEUS to create a project, but since there is no PIC16F18346 in the proteus, I take PIC16F1829 to create a project in MPLAB X, I configure it in MSS, compile it, run it in the proteus, everything works. At the same time, the lion and the master, everything works as I want.
post edited by BUVA - 2020/02/22 02:31:38
#9
Gort2015
Klaatu Barada Nikto
  • Total Posts : 3845
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
Flagged as Spam (1)
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/22 04:37:24 (permalink)
0 (2)
Some one didn't agree.

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#10
BUVA
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2018/08/29 11:31:18
  • Location: 0
  • Status: offline
Re: simultaneous work PIC16F18346 in master and slave mode 2020/02/22 10:42:49 (permalink)
0
Thanks to everyone who responded. Reinstalled MPLAB X and the MCC to the old version and it worked. I don’t know where the problem is. I think in the MCC. Too new version differs in code generation.
#11
Jump to:
© 2020 APG vNext Commercial Version 4.5