CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using external RAM for data exchange between two MC (8 bit)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dmitrboristuk



Joined: 26 Sep 2020
Posts: 55

View user's profile Send private message

Using external RAM for data exchange between two MC (8 bit)
PostPosted: Wed Sep 04, 2024 3:52 am     Reply with quote

Hello. There is one microcontroller with a program with a large number of interrupts. The organization of data exchange using MODBUS is very complex, especially when packets up to 30 bytes are transmitted and received. Disabling interrupts during transmission is not allowed, because it will lead to the crash of the main program flow. There are ideas to organize data exchange via external RAM, to which access from two microcontrollers can be organized. Ideally, I found a CAT24C208 microcircuit with dual access, but it is better to do it on the more common PCF8570 (or newer). My question is how to organize arbitration between microcontrollers during memory access. But maybe there are other solutions. I would like to get information and see examples of program code.
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Wed Sep 04, 2024 7:53 am     Reply with quote

So much here depends on the speed you actually need.
Understand, you can use quite conventional RAM, provided neither
microcontroller accesses at the same time, and your data writes/reads
are structured so that each device can tell when a packet is complete.
You just use a slow external clock, and only perform the access from
controller #1 on the low half cycle of this, with the other on the high
half cycle. Provided each transaction can complete in the half cycle, no
problem.

The easiest/fastest/best way, is just to use dual port RAM. Look at
something like the Renesas chips:
[url]
https://www.renesas.com/us/en/products/memory-logic/multi-port-memory/asynchronous-dual-port-rams?gad_source=1
[/url]

Normally you'd use either a busy line, or have once chip operate a
semaphore to give synchronisation.
dmitrboristuk



Joined: 26 Sep 2020
Posts: 55

View user's profile Send private message

PostPosted: Wed Sep 04, 2024 1:14 pm     Reply with quote

Ttelmah Thank you for your answer, I will try to do it this way. But first I want to try to run a request from a short interrupt procedure on the Master I2C device to read/write the memory of the Slave device. I want to use the Slave port output as a "hard semaphore". How do you like this idea?
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Thu Sep 05, 2024 6:31 am     Reply with quote

It sounds as if you are talking quite a slow link. So an I2C memory, and
a simple semaphore. You can do a semaphore by wiring a wire for 'wire OR'
operation. Single wire, pull up resistor, and each device only drives the
line low or lets it float. You do have a slight complexity if both devices
can control the line, of handling when both try to start at the same time,
but it only one device controls this, and the slave always does it's
transaction soon after the line is operated by the master, this can work.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group