Develop a syntactically correct C program for the asynchronous serial communications protocol as follows. Your program should set up the USART1 Module of the STM32F4 microcontroller to communicate (transmit and receive) at the rate of approx. 50000 Baud. You should choose suitable clock rates for this problem. The frame should consist of a start bit, seven data bits, even parity bit, and one stop bit. It is up to you to decide whether you want to work with interrupts or with the polling method. The program first waits for a syn character (syn=0x16) but will only accept it if no receive error flags (FE, PE, or ORE) are set. If any error flags are set the program shall respond by sending a nak character (nak=0x15), it will send an ack character (ack=0x06), otherwise. The process repeats until a received syn character is accepted. However, the program should keep a syn receive error count. If the error count reached the value 5 then the program would enter an infinite waiting loop with return (1). Otherwise, the communication protocol will move on to the next phase in which the program will wait for a single, visible, valid ASCII character. If it is received without any error (see above), the program shall respond by sending an ack, it will send a nak, otherwise. The process repeats until the ASCII character is received without any error. The accepted character should be written to a memory location. Again, if the character receive error count reached the value 5 then the program would enter an infinite waiting loop with return (2). Having successfully received a character the program should be terminated by an infinite waiting loop with return (0).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hi! Can you please help me with the code for this? It's written using CubeMX and IAR for the STM32F429ZI microcontroller board.

Develop a syntactically correct C program for the asynchronous serial communications
protocol as follows. Your program should set up the USART1 Module of the STM32F4
microcontroller to communicate (transmit and receive) at the rate of approx. 50000 Baud.
You should choose suitable clock rates for this problem. The frame should consist of a
start bit, seven data bits, even parity bit, and one stop bit. It is up to you to decide
whether you want to work with interrupts or with the polling method.
The program first waits for a syn character (syn=0x16) but will only accept it if no
receive error flags (FE, PE, or ORE) are set. If any error flags are set the program shall
respond by sending a nak character (nak=0x15), it will send an ack character
(ack=0x06), otherwise. The process repeats until a received syn character is accepted.
However, the program should keep a syn receive error count. If the error count reached
the value 5 then the program would enter an infinite waiting loop with return (1).
Otherwise, the communication protocol will move on to the next phase in which the
program will wait for a single, visible, valid ASCII character. If it is received without
any error (see above), the program shall respond by sending an ack, it will send a nak,
otherwise. The process repeats until the ASCII character is received without any error.
The accepted character should be written to a memory location. Again, if the character
receive error count reached the value 5 then the program would enter an infinite waiting
loop with return (2). Having successfully received a character the program should be
terminated by an infinite waiting loop with return (0). 

 

I've been trying to get the polling method to work, but I'm incredibly stuck.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education