Vending Machine Application on SAM E54 Xplained Pro Evaluation Kit
Download
Description:
The application implements an embedded network application to update and track drinks status of a Vending Machine (VM).
- The SAM E54 Xplained Pro Evaluation Kit will act as a HTTP-Server to keep track of the items in the Vending Machine.
- The HTTP-Client (PC web page) talks to the HTTP-server and displays the status of the Vending Machine.
- The OLED1 Xplained Pro extension kit will act man machine interface (MMI) to select and confirm drinks with buttons (up/down and select) and an OLED displays VM information.
- The VM application uses Button 1 (Down) and Button 2 (Up) to scroll through the VM items and Button 3 to select an item from the Vending Machine.
- The LEDs above the button indicates a button press with a blink.
- The OLED (128 x 32) is used to display the drink name and their corresponding number of the items in a Vending Machine.
- When Button 3 (Select) is pressed the HTTP-Server will decrement the count of an item and updates the HTTPClient(Web page) through ethernet interface.
- When a Bay of a VM is empty it sends out a message to a specific TCP server.
Modules/Technology Used:
- Peripheral Modules
- TC
- NVMCTRL
- SERCOM(SPI)
- SERCOM(USART)
- Driver Modules
- MEMORY
- I2C Driver
- System service
- TIME
- CONSOLE, DEBUG, COMMAND
- Libraries
- TCP/IP stack
- Microchip File System (together with MPFS utility)
- Third Party Library
- FreeRTOS
- gfx mono library (from ASF)
Hardware Used:
- SAM E54 Xplained Pro Evaluation Kit
- OLED1 Xplained Pro extension kit
- Cat 5 Ethernet Cable
- USB Male A to USB Male B Micro Cable
Software/Tools Used:
This project has been verified to work with the following versions of software tools:
Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware/src/config/sam_e54_xpro
- Refer the Release Notes to know the MPLAB X IDE and MCC Plugin version. Alternatively, Click Here
- Any Serial Terminal application like Tera Term terminal application.
- Any TCP/IP debug application, such as Hercules SETUP utility - useful serial port terminal (RS-485 or RS-232 terminal) , UDP/IP terminal and TCP/IP Client Server terminal. Produced by www.HW-group.com.
Because Microchip regularly update tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project doesn’t seem to work and version incompatibility is suspected, It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature
Setup:
- Connect the OLED1 Xplained Pro extension kit to Extension Header 1 (EXT1) on the SAM E54 Xplained Pro Evaluation Kit
- Establish a connection between the router/switch with the SAM E54 Xplained Pro Evaluation Kit through the RJ45 connector. Make sure your PC is connected to the same router/switch.
-
Connect the micro USB cable from the computer to the DEBUG USB connect on the SAM E54 Xplained Pro Evaluation Kit
Programming hex file:
The pre-built hex file can be programmed by following the below steps
Steps to program the hex file
- Open MPLAB X IDE
- Close all existing projects in IDE, if any project is opened.
- Go to File -> Import -> Hex/ELF File
- In the “Import Image File” window, Step 1 - Create Prebuilt Project, click the “Browse” button to select the prebuilt hex file.
- Select Device has “ATSAME54P20A”
- Ensure the proper tool is selected under “Hardware Tool”
- Click on “Next” button
- In the “Import Image File” window, Step 2 - Select Project Name and Folder, select appropriate project name and folder
- Click on “Finish” button
- In MPLAB X IDE, click on “Make and Program Device” Button. The device gets programmed in sometime.
- Follow the steps in “Running the Demo” section below
Programming/Debugging Application Project:
- Open the project (same54_vending_machine\firmware\sam_e54_xpro.X) in MPLAB X IDE
- Ensure “EDBG” is selected as hardware tool to program/debug the application
- Build the code and program the device by clicking on the “make and program” button in MPLAB X IDE tool bar
- Follow the steps in “Running the Demo” section below
Running the Demo:
- Open the Tera Term terminal application on your PC, select the virtual COM port of SAM E54 Xplained Pro Evaluation Kit, and change the baud rate to 115200
- You should see the text on the OLED screen in series like the screens below:
- You should see demo information and IP address (after DHCP success) in Tera Term terminal, as shown below:
-
Open a web browser and enter the HTTP- Server IP address (e.g. http://192.168.1.101) that you got on the tera term in the previous step. Click on the ‘Vending Machine’ tab to see the page for the Vending Machine Demo.
-
Use the Button 1 and Button 2 on the OLED1 Xplained Pro to scroll through the items of the Vending Machine. Use the Button 3 on the OLED to pick an item from the VM. The count of the corresponding item on the OLED screen will be decremented by 1 and is reflected on the Web page as well as on the OLED screen.
-
Run Hercules SETUP utility, and start TCP Server to listen on Port 80
- Note: you need to update source code in app.c to fill your PC’s IP address that running this TCP Server
-
Press the select Button 3 and make one or more item to zero count. After few second, you will see this screen to notice bay empty (e.g. item 1. coca-cola).
- In ‘Vending Machine’ webpage, you can pick an ITEM and change the COUNT to a new number, then press UPDATE to confirm.
Comments:
- Reference Training Module:
- Getting Started with Harmony v3 Peripheral Libraries on SAM D5x/E5x MCUs
- Create your first tcpip application
- Look MPLAB Harmony TCP/IP Help documentaion for Harmony 3 Net APIs and how to use MPFS utility to generate MPFS image of web pages.
- This application demo builds and works out of box by following the instructions above in “Running the Demo” section. If you need to enhance/customize this application demo, you need to use the MPLAB Harmony v3 Software framework. Refer links below to setup and build your applications using MPLAB Harmony.
- How to Setup MPLAB Harmony v3 Software Development Framework
- How to Build an Application by Adding a New PLIB, Driver, or Middleware to an Existing MPLAB Harmony v3 Project
- MPLAB Harmony v3 is also configurable through MPLAB Code Configurator (MCC). Refer to the below links for specific instructions to use MPLAB Harmony v3 with MCC.
Revision:
- v1.6.0 Regenerated and tested application
- v1.5.0 Removed MHC support, regenerated and tested application
- v1.4.0 Added MCC support, regenerated and tested application
- v1.3.0 Regenerated and tested application
- v1.2.0 Regenerated and tested application
- v1.1.0 Released demo application