carmlcdstm32f4discoveryusart

How to connect two STM32F4-Discovery cards with LCDs through USART


I am currently doing a project in school where me and my group are supposed to make the game "Bomberman" and execute it on a STM32F4-Discovery card (which has an ARM based processor on it). The game is displayed on a small LCD touchscreen that is connected to the discovery card, the touchscreen is also used as the controller for the game. The game is playable as of now, everything executes correctly and you can play alone against three AI-characters. The game and all hardware initiations are written entirely in C.

Now we have decided we want to implement multiplayer in the game, meaning we will have two setups of STM32F4-Discovery cards and LCD touchscreens. Each setup controls one player on the same game map. We are supposed to connect the two setups through USART.

My question is, how do we make these two STM32F4-Discovery cards communicate and display the same game map? I've tried to google it without any success so I now turn to you at stackoverflow.

EDIT: I am adding a follow up question in the light of the information provided by Unwind.

Follow up question:

We got a lot of pre-written files that we could use to initiate our hardware etc. One of these files are called STM32F4xx-usart.c. It contains a function:

void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct).

The USART_InitStruct looks like this (it was pre-defined in the code that we got):

typedef struct{
uint32_t USART_BaudRate;
uint16_t USART_WordLength;
uint16_t USART_StopBits;
uint16_t USART_Parity;
uint16_t USART_Mode;
uint16_t USART_HardwareFlowControl;
} USART_InitTypeDef;

I am guessing I will have to use this structure to form two new structs that will hold the values for my master card and my slave card.

My question is: How do I write these two structs so that I can pass it to the init_USART() function? You don't need to provide any values, only the syntax.

I tried

struct USART1_initStruct{
    uint32_t USART_BaudRate;
    uint16_t USART_WordLength;
    uint16_t USART_StopBits;
    uint16_t USART_Parity ;
    uint16_t USART_Mode ;
    uint16_t USART_HardwareFlowControl;
} U1IS = {9600, USART_WordLength_9b, USART_StopBits_1, USART_Parity_No, USART_Mode_Tx, USART_HardwareFlowControl_None};

and then passing this struct to the function, but I got an error:

error: expected expression before 'struct'

Solution

  • Make one of the boards the master, and the other the slave.

    The job of the master (or server) is to run the game and decide what happens. The role of the slave (or client) is to display the world view to its local player, send input to the master and receive updates on the game's objects.

    You can also view it as two slaves, connected to a single master which also happens to run on the same physical machine as one of the slaves.

    It's not going to be very simple, especially since it sounds as if you didn't design for this from the beginning which usually helps.