Warning
This page is located in archive. Go to the latest version of this course pages. Go the latest version of this page.

Lab03 - Nucleo Echo

  • Find the appropriate device (serial line) to receive data - use cat command to receive the data and echo for sending data.
  • Write a program that will open the communication device and print the data sent from Nucleo.
  • Get a good grasp of blocking and non-blocking functions.
  • Get familiar with HomeWork 02.

Instructions

  • Download the files of this lab from ide_usart_2.zip.
  • Compile the code and upload it to the board according to Lab02.
  • Open a terminal and write the code below to get data from board.

stty -F /dev/ttyACM0 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echoke 115200
cat /dev/ttyACM0 

If you face any problem in this stage inform lab instructors.

  • In another terminal write code

echo led1 >/dev/ttyACM0

After this command, green led on your board should turn on. If you send the code below,

echo led0 >/dev/ttyACM0

green led should be off.

  • This way, a communication bridge between board and PC is built. Check main.c file to find out how this bridge was built.

Lab Tasks

Modify main.c in a way that

  • Switch the logic of led0 and led1, in a way that led0 turns on the green led and led1 turns it off.
  • When board starts to work, make it print your name.
  • when command name is given to board, make it print your name.
  • Avoid board from printing repetitive strings until the input is changed.
  • define a command ledb which blinks led with a frequency of 20 Hz. In order to do this, you should decrease the waiting time of the receiver function to 10 ms.
courses/be5b99cpl/labs/lab03.txt · Last modified: 2021/10/05 22:30 by amjadara