+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Full Member level 6
    Points: 3,903, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    323
    Helped
    10 / 10
    Points
    3,903
    Level
    14

    Multi. Microcontroller design

    Hi friends,
    I am working on an application where there are 2 pcb boards.

    Board 1 is doing a critical task so it can't be used for user defined settings via lcd and switches.

    Board 2 is having lcd and switches so we have to use it for saving the settings. But these settings have to be transferred to board 1 so that it can be used by board 1 for its working......
    Everytime any setting is changed on board 2 it has to be reflected on board 1.There are some 50 variables of unsigned int type that need to be transferred from board 2 to board 1.

    So I would like to know what is the best way to do it.Should I transfer the data in ascii form. That will be approx 200characters if I transfer all the variables.

    Or should I go with one variable at a time with some header and then data. for example if I need to send 20000 then I use #__20000$
    where __ is for type of data ranging from 0-99..
    i.e I can send 99 variables of unsigned int type.

    The board 1 does some critical work. So the data sent via board 2 UART will. Be received via Board 1 UART via interrupt.

    Also if we need to Display some data from board 1 then board 1 can transmit the data to board 2 via UART.

    Please let me know how to proceed in such scenario....

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 72,564, Level: 65
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,749
    Helped
    3367 / 3367
    Points
    72,564
    Level
    65

    Re: Multi. Microcontroller design

    Hi,

    There are many solutions depending on your requirements.

    If you are sending via UART, then I recommend to use the format to be most comfortable for Board1.
    Which means:
    * easy to parse
    * low byte count
    * the frame should start with a single byte "message identifier"
    * the frame should end with a unique "EOL" marker
    * optionally (I recommend it) the frame should contain a checksum

    ****
    Check whether SPI or I2C is more suitable.

    ****
    In one similar application I even used a "dual port RAM".
    If I have to design the same again I used an FPGA instead.

    ***
    Also consider a SPI_RAM or I2C_RAM with multiplexed bus. This needs a careful arbitration scheme.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisment

        
       

  3. #3
    Advanced Member level 5
    Points: 8,980, Level: 22
    Achievements:
    7 years registered
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,585
    Helped
    362 / 362
    Points
    8,980
    Level
    22

    Re: Multi. Microcontroller design

    I would suggest to stop for a while and think. There are totally mess in your head. May be we should start from beggining? What you want to achive?
    Love me or hate me. All infractions will be ignored.



    •   AltAdvertisment

        
       

  4. #4
    Full Member level 6
    Points: 3,903, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    323
    Helped
    10 / 10
    Points
    3,903
    Level
    14

    Re: Multi. Microcontroller design

    Quote Originally Posted by Easyrider83 View Post
    I would suggest to stop for a while and think. There are totally mess in your head. May be we should start from beggining? What you want to achive?
    Dear friend, May be you are not able to understand the problem. I m very clear about the issue and have received a reply also regarding the same. So please don't judge others if you are not able to understand the issue.



  5. #5
    Full Member level 5
    Points: 2,397, Level: 11

    Join Date
    Oct 2012
    Posts
    249
    Helped
    66 / 66
    Points
    2,397
    Level
    11

    Re: Multi. Microcontroller design

    Keep the data in byte form (~50% less data movement than ASCII, no interpretation required on board 1). Create a data packet scheme to send data and requests to board 1. To keep things simple, maybe just send 1 variable at a time rather than all 50+. I would also suggest a fixed packet size going from board 2 to board 1.

    Maybe:

    Byte 1: Message start; is this a variable or a request for data?
    Byte 2: Variable number or request number.
    Byte 3: MSB of variable or dummy data if a request
    Byte 4: LSB of variable or dummy data if a request
    Byte 5: Checksum of message
    Byte 6: End of transmission byte

    Board 1 should send some kind of acknowledge message after the 6 bytes are received and interpreted (Message OK or error) as a handshake.

    If the data coming back from board 1 to board 2 doesn't fit this scheme, you can create a different scheme for the return data. You're writing both end so it's up to you.
    Last edited by spudboy488; 15th April 2019 at 12:40.


    1 members found this post helpful.

    •   AltAdvertisment

        
       

  6. #6
    Full Member level 1
    Points: 594, Level: 5

    Join Date
    Jan 2019
    Posts
    119
    Helped
    21 / 21
    Points
    594
    Level
    5

    Re: Multi. Microcontroller design

    you can also assign each byte of data an address and upload only the byte that changed.
    this can reduces the transmission to 2 bytes - and address and a dataum.
    and a checksum or some error detect and correct scheme - fairly easy for 16 bits.

    data transmission is generally much faster than human changing of switches, even at the relatively slow rate of 1 bit per microsecond.



  7. #7
    Super Moderator
    Points: 253,898, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,245
    Helped
    13463 / 13463
    Points
    253,898
    Level
    100

    Re: Multi. Microcontroller design

    Why not use an industry standard protocol, e.g. MODBUS RTU?



--[[ ]]--