# 2021 RPi Interview Project ###### tags: `tutorial` `electrical_system` `NTURT` ### Introduction In order to know that whether you are familiar with linux command after the summer course we provide, we design a small project for you all. There are 8 tasks in the project. After you pass each task, you will get a key corresppndong to the task. When you get all keys, you have to send these keys from RPi to a stm32 board through CAN Bus, after that, you will receive 8 keys from the stm32. If your key obtains from each task is right, then you will receive a valid key. Otherwise, you will get 0 in the corresponding position. #### example If the right key is [1, 2, 3, 4, 5, 6, 7, 8], and you send [1, 2, 3, 4, 5, 6, 7, 8] to the stm32, then you will get a message ``` Timestamp: 1630248135.853531 ID: 0091 S DLC: 8 e9 17 29 b6 59 86 dc 5d Channel: can0 ``` > notice that this is just a sample output, and you can see that the data of the message is [e9, 17, 29, b6, 59, 86, 5d] On the other hand, if you send [1, 0, 0, 0, 0, 0, 0, 8] to the stm32, you will get ``` Timestamp: 1630248135.853531 ID: 0091 S DLC: 8 e9 00 00 00 00 00 00 5d Channel: can0 ``` > you can see that if the key is wrong, you'll get 00 in the corresponding poition ### How to connect to the RPi 1. open your terminal 2. type ```shell ssh username@140.112.250.102 -p 80 ``` and your password: **raspberry** > note that username is **your** username, don't type "username" to log in 3. type ```shell cp -r /home/template/* . ls ``` and you should see the output be ```shell 1 2 3 4 5 6 7 8 CAN_send_receive.py init.sh ``` 4. type ```bash bash init.sh ``` 5. everything is done ### Task Introduction 1. the number is the filename 2. the number is in a file 3. the number is a hidden file's filename 4. given a git repo, the number can be found in another branch 5. given a git repo, the number can be found in previous commit 6. execute a file, the output will be printed after a day. To run the program, type ```shell ./key ``` in the directory. > hint: If you are disconnected to the RPi, the program you are running will be killed. 7. the key is in a figure > hint: Since it's nearly impossible to view a figure from command line, you might have to get a copy of the figure to your computer. How? try to google it! 8. bitwise operation > The key to the task is encrypted by some bitwise operations, the operations are specified in the README file, try to decrypt it by doing inverse bitwise operation. ### How to send the keys to the stm32 There is a python file named **CAN_send_receive.py** in your directory, fill your keys in the proper position, and execute the file ```shell python3 CAN_send_receive.py ``` and you should get a message from the stm32, note that you don't have to do anything with the stm32.