Difference between revisions of "Getting Started with CutiPy and FreeRTOS"

From wiki.emacinc.com
Jump to: navigation, search
Line 27: Line 27:
 
2. Download EMAC's CutiPy FreeRTOS project </br>  
 
2. Download EMAC's CutiPy FreeRTOS project </br>  
 
3. Connect the ST-Link programmer to the CutiPy board for programming </br>
 
3. Connect the ST-Link programmer to the CutiPy board for programming </br>
*Connect the 10 pin SWD connector (small ribbon cable) to the CutiPy Board HDR6. Ensure the the painted red wire of the cable is on the same side as the arrow. Connect the other end to the adaptor, again ensuring the arrow is aligned with painted red wire. Connect the ST-Link to the adaptor with the large ribbon cable, and connect the ST-LINK to your desktop with it's provided USB cable </br>
+
*''Connect the 10 pin SWD connector (small ribbon cable) to the CutiPy Board HDR6. Ensure the the painted red wire of the cable is on the same side as the arrow.Connect the other end to the adaptor, again ensuring the arrow is aligned with painted red wire. Connect the ST-Link to the adaptor with the large ribbon cable, and connect the ST-LINK to your desktop with it's provided USB cable'' </br>
 +
 
 
4. Connect your CutiPy to Desktop using the micro-USB to USB cable. Your board is now powered. </br>
 
4. Connect your CutiPy to Desktop using the micro-USB to USB cable. Your board is now powered. </br>
 
5. Open STM32CubeIDE and import the CutiPy FreeRTOS project </br>
 
5. Open STM32CubeIDE and import the CutiPy FreeRTOS project </br>
 +
*If needed, upgrade your ST-LINK firmware by navigating to '''Help''' and selecting '''ST-LINK Upgrade'''. The ST Link upgrade window will open. Select '''refresh device list''', and then select '''Open in update mode''', and finally '''Upgrade'''
 
6. Build and upload the firmware </br>
 
6. Build and upload the firmware </br>
 +
*''To build and upload select the debug symbol (To just build select the hammer symbol)''.
  
*On Windows:
 
  
**Open device manager, right click on the new device, and click 'Update driver software'.
 
**Browse for 'pybcdc.inf' which should be on the Cutipy (It will show up similar to a USB thumb drive, the directory will be called PYBFLASH), select this file.
 
**The device should now show up under 'ports'.
 
 
[[File:CutipyPorts.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]
 
<br clear=all>
 
 
**Open PuTTY and select a ‘Serial’ connection type and enter the Comm Port shown on your ‘Device Manager’.
 
 
[[File:CutipyPutty.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]
 
<br clear=all>
 
 
*On Linux/Mac:
 
 
**Figure out which tty your device is connected to (Most likely /dev/ttyACM0). You can do this by running 'dmesg -w' and then plugging in the board.
 
**Follow [[ Getting_Started_With_Minicom | these instructions ]] to set up minicom. When setting the 'Serial Device', enter the port you found in the step above.
 
 
4. You should now have a REPL session open with the Cutipy. This is identical to a typical Python3 CLI interface.
 
  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 57: Line 41:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:using | initials=BS | title=Developing with the Cutipy | desc=The following page can be used to get familiarized with Micropython the Cutipy. | project=OE 5.0 }}
 
{{:Templateimpl:using | initials=BS | title=Developing with the Cutipy | desc=The following page can be used to get familiarized with Micropython the Cutipy. | project=OE 5.0 }}
1. Using your choice of text editor / IDE, you can write [[ Micropython | Micropython ]] scripts.
 
  
2. From there, they can be loaded onto the Cutipy by simply moving the python file to the PYBFLASH directory.
+
1.The baseline CutiPy FreeRTOS build has now been uploaded. Connect to the USB virtual com port on a serial terminal using Putty or TerraTerm.
 +
 
 +
2.After connecting the CutiPy FreeRTOS menu will be displayed. Navigate to tests for a demonstration of CutiPy functionality.
 +
 +
 
 +
EMAC has provided custom driver functions for the CutiPy's main peripherals. These are located under '''CutiPy_Drivers'''. See the source files for function descriptions. All of EMAC's custom functions will be prefixed by '''CP_''' followed by the the '''DRIVER_NAME'''. Functions with the prefix '''CP_FRTOS''' utilize an RTOS element and should only
 +
be called with the scheduler running. We recommend user files be added to the '''CutiPy_User''' or that the user add their own custom folders, and not modify the project code directly. EMAC has provide custom system tasks to ease CutiPy use.
  
3. Run these files by simple typing "import ''filename''" in the REPL session.
 
  
 
[[File:CutipyEditor.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]
 
[[File:CutipyEditor.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]

Revision as of 17:25, 13 March 2020

This page outlines a basic guide to getting starting using the Cutipy.

General Information

Tools Required

  • Desktop PC (Windows/Linux/Mac will work)
  • Micro-USB to USB Cable
  • ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32 with JTAG 20 pin to SWD 10pin adaptor


Setup

1. Download and install STM32CubeIDE (The IDE used for CutiPy FreeRTOS development)
2. Download EMAC's CutiPy FreeRTOS project
3. Connect the ST-Link programmer to the CutiPy board for programming

  • Connect the 10 pin SWD connector (small ribbon cable) to the CutiPy Board HDR6. Ensure the the painted red wire of the cable is on the same side as the arrow.Connect the other end to the adaptor, again ensuring the arrow is aligned with painted red wire. Connect the ST-Link to the adaptor with the large ribbon cable, and connect the ST-LINK to your desktop with it's provided USB cable

4. Connect your CutiPy to Desktop using the micro-USB to USB cable. Your board is now powered.
5. Open STM32CubeIDE and import the CutiPy FreeRTOS project

  • If needed, upgrade your ST-LINK firmware by navigating to Help and selecting ST-LINK Upgrade. The ST Link upgrade window will open. Select refresh device list, and then select Open in update mode, and finally Upgrade

6. Build and upload the firmware

  • To build and upload select the debug symbol (To just build select the hammer symbol).


Developing with the Cutipy

1.The baseline CutiPy FreeRTOS build has now been uploaded. Connect to the USB virtual com port on a serial terminal using Putty or TerraTerm.

2.After connecting the CutiPy FreeRTOS menu will be displayed. Navigate to tests for a demonstration of CutiPy functionality.


EMAC has provided custom driver functions for the CutiPy's main peripherals. These are located under CutiPy_Drivers. See the source files for function descriptions. All of EMAC's custom functions will be prefixed by CP_ followed by the the DRIVER_NAME. Functions with the prefix CP_FRTOS utilize an RTOS element and should only be called with the scheduler running. We recommend user files be added to the CutiPy_User or that the user add their own custom folders, and not modify the project code directly. EMAC has provide custom system tasks to ease CutiPy use.


Figure 2: Qt Creator EMAC Project



Pages with Related Content

CutiPy Micropython Documentation

Cutipy Test Software

Cutipy-MicroPython Bluetooth LE demo

Micropython

CutiPy-Installing Micropython Firmware