diff --git a/cylib b/cylib deleted file mode 120000 index f0d7b7c..0000000 --- a/cylib +++ /dev/null @@ -1 +0,0 @@ -configutility/linux/library/ \ No newline at end of file diff --git a/configutility/linux/library/90-cyusb.rules b/cylib/90-cyusb.rules similarity index 100% rename from configutility/linux/library/90-cyusb.rules rename to cylib/90-cyusb.rules diff --git a/configutility/linux/library/CyUSBCommon.h b/cylib/CyUSBCommon.h similarity index 100% rename from configutility/linux/library/CyUSBCommon.h rename to cylib/CyUSBCommon.h diff --git a/configutility/linux/library/Makefile b/cylib/Makefile similarity index 100% rename from configutility/linux/library/Makefile rename to cylib/Makefile diff --git a/configutility/linux/library/cyboot.c b/cylib/cyboot.c similarity index 100% rename from configutility/linux/library/cyboot.c rename to cylib/cyboot.c diff --git a/configutility/linux/library/cyi2c.c b/cylib/cyi2c.c similarity index 100% rename from configutility/linux/library/cyi2c.c rename to cylib/cyi2c.c diff --git a/configutility/linux/library/cyjtag.c b/cylib/cyjtag.c similarity index 100% rename from configutility/linux/library/cyjtag.c rename to cylib/cyjtag.c diff --git a/configutility/linux/library/cymisc.c b/cylib/cymisc.c similarity index 100% rename from configutility/linux/library/cymisc.c rename to cylib/cymisc.c diff --git a/configutility/linux/library/cyphdc.c b/cylib/cyphdc.c similarity index 100% rename from configutility/linux/library/cyphdc.c rename to cylib/cyphdc.c diff --git a/configutility/linux/library/cyspi.c b/cylib/cyspi.c similarity index 100% rename from configutility/linux/library/cyspi.c rename to cylib/cyspi.c diff --git a/configutility/linux/library/cyuart.c b/cylib/cyuart.c similarity index 100% rename from configutility/linux/library/cyuart.c rename to cylib/cyuart.c diff --git a/configutility/linux/library/cyusb.c b/cylib/cyusb.c similarity index 100% rename from configutility/linux/library/cyusb.c rename to cylib/cyusb.c diff --git a/configutility/linux/library/libcyusbserial.so.1 b/cylib/libcyusbserial.so.1 similarity index 100% rename from configutility/linux/library/libcyusbserial.so.1 rename to cylib/libcyusbserial.so.1 diff --git a/docs/newmanual.md b/docs/newmanual.md index 7c57b28..17772d3 100644 --- a/docs/newmanual.md +++ b/docs/newmanual.md @@ -20,19 +20,14 @@ To start using TinI/O, make sure you have: - A TinI/O compatible board - They can be obtained from Cypress, the manufacturer of the chip. The board I personally use and recommend is the [CY8CKIT-049-4xxx PSoC4 prototyping kit](http://www.cypress.com/documentation/development-kitsboards/psoc-4-cy8ckit-049-4xxx-prototyping-kits), but there are more of them out there, for example, the [CYUSBS234 USB-Serial (Single Channel) Development Kit](http://www.cypress.com/documentation/development-kitsboards/cyusbs234-usb-serial-single-channel-development-kit), which uses the same chip, or the [CYUSB232 USB-UART LP Reference Design Kit](http://www.cypress.com/documentation/development-kitsboards/cyusbs232-usb-uart-lp-reference-design-kit) and the [CYUSBS236 USB-Serial (Dual Channel) Development Kit](http://www.cypress.com/documentation/development-kitsboards/cyusbs236-usb-serial-dual-channel-development-kit), that have different chips from the same family. + They can be obtained from Cypress, the manufacturer of the chip. The board I personally use and recommend is the [CY8CKIT-049-4xxx PSoC4 prototyping kit](http://www.cypress.com/documentation/development-kitsboards/psoc-4-cy8ckit-049-4xxx-prototyping-kits), but there are more of them out there, for example, the [CYUSBS234 USB-Serial (Single Channel) Development Kit](http://www.cypress.com/documentation/development-kitsboards/cyusbs234-usb-serial-single-channel-development-kit). # Building and installing TinI/O ## The easy way After you make sure that your computer complies with the system requirements (it probably does), you need to build and install TinI/O. The simplest way to do that is to run the `autobuilder` script in the project root (aka the folder you downloaded TinI/O source to) __as root__. The script will then start the build process and redirect any text from its underlying programs to the standard output. The output should look like this: -
- -Long text - Click to expand - -
-
+```
 # ./autobuilder
     --------------------------
     Autobuilder for TinI/O 0.1
@@ -61,116 +56,6 @@ In file included from cyboot.c:1:0:
 CyUSBCommon.h:74:0: note: this is the location of the previous definition
  #define CY_USB_SERIAL_TIMEOUT 5000
 
-cyboot.c: In function ‘CyFlashConfigEnable’:
-cyboot.c:634:21: warning: unused variable ‘ioTimeout’ [-Wunused-variable]
-     UINT32 rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT;
-                     ^~~~~~~~~
-gcc -shared -g -Wl,-soname,libcyusbserial.so -o libcyusbserial.so.1 libcyusb.o libcyuart.o libcyi2c.o libcyspi.o libcyphdc.o libcyjtag.o libcymisc.o libcyboot.o -l usb-1.0
-cp libcyusbserial.so.1 /usr/local/lib
-ln -sf /usr/local/lib/libcyusbserial.so.1 /usr/local/lib/libcyusbserial.so
-ldconfig
-rm -f libcyusb.o libcyuart.o libcyspi.o libcyi2c.o libcyphdc.o libcyjtag.o libcymisc.o libcyboot.o
-    DONE!
-    Library installation complete.
-    Going back...
-    DONE!
-    Entering the TinI/O build directory
-    DONE!
-    Compiling TinI/O
-make: 'tinio' is up to date.
-echo "Installing tinio..."
-Installing tinio...
-cp tinio /usr/bin
-echo "done."
-done.
-    DONE!
-    Compiling the flasher tool
-#	gcc -g -o CyUSBSerialTestUtility Test_Utility.c -lcyusbserial -w
-gcc -g -o CyUSBSerialCommandUtility Command_Utility.c -lcyusbserial
-Command_Utility.c: In function ‘deviceHotPlug’:
-Command_Utility.c:102:35: warning: passing argument 1 of ‘CyGetListofDevices’ from incompatible pointer type [-Wincompatible-pointer-types]
-     rStatus = CyGetListofDevices (&numDevices);
-                                   ^
-In file included from Command_Utility.c:33:0:
-../../common/header/CyUSBSerial.h:705:30: note: expected ‘UINT8 * {aka unsigned char *}’ but argument is of type ‘int *’
- CYWINEXPORT CY_RETURN_STATUS CyGetListofDevices (
-                              ^~~~~~~~~~~~~~~~~~
-Command_Utility.c:105:16: warning: ‘return’ with a value, in function returning void
-         return rStatus;
-                ^~~~~~~
-Command_Utility.c:95:6: note: declared here
- void deviceHotPlug () {
-      ^~~~~~~~~~~~~
-Command_Utility.c:107:5: warning: implicit declaration of function ‘printListOfDevices’ [-Wimplicit-function-declaration]
-     printListOfDevices (false);
-     ^~~~~~~~~~~~~~~~~~
-Command_Utility.c: In function ‘main’:
-Command_Utility.c:139:35: warning: passing argument 1 of ‘CyGetListofDevices’ from incompatible pointer type [-Wincompatible-pointer-types]
-     rStatus = CyGetListofDevices (&numDevices);
-                                   ^
-In file included from Command_Utility.c:33:0:
-../../common/header/CyUSBSerial.h:705:30: note: expected ‘UINT8 * {aka unsigned char *}’ but argument is of type ‘int *’
- CYWINEXPORT CY_RETURN_STATUS CyGetListofDevices (
-                              ^~~~~~~~~~~~~~~~~~
-Command_Utility.c:268:51: warning: passing argument 2 of ‘CyReadDeviceConfig’ from incompatible pointer type [-Wincompatible-pointer-types]
-                 rStatus=CyReadDeviceConfig(handle,&read_buffer);
-                                                   ^
-In file included from Command_Utility.c:34:0:
-../../common/header/CyUSBBootloader.h:203:45: note: expected ‘UCHAR * {aka unsigned char *}’ but argument is of type ‘unsigned char (*)[512]’
- CYWINEXPORT CY_RETURN_STATUS  WINCALLCONVEN CyReadDeviceConfig (
-                                             ^~~~~~~~~~~~~~~~~~
-Command_Utility.c: At top level:
-Command_Utility.c:382:6: warning: conflicting types for ‘printListOfDevices’
- void printListOfDevices (bool isPrint)
-      ^~~~~~~~~~~~~~~~~~
-Command_Utility.c:107:5: note: previous implicit declaration of ‘printListOfDevices’ was here
-     printListOfDevices (false);
-     ^~~~~~~~~~~~~~~~~~
-Command_Utility.c: In function ‘printListOfDevices’:
-Command_Utility.c:396:25: warning: passing argument 1 of ‘CyGetListofDevices’ from incompatible pointer type [-Wincompatible-pointer-types]
-     CyGetListofDevices (&numDevices);
-                         ^
-In file included from Command_Utility.c:33:0:
-../../common/header/CyUSBSerial.h:705:30: note: expected ‘UINT8 * {aka unsigned char *}’ but argument is of type ‘int *’
- CYWINEXPORT CY_RETURN_STATUS CyGetListofDevices (
-                              ^~~~~~~~~~~~~~~~~~
-Command_Utility.c:445:75: warning: backslash and newline separated by space
-               printf ("%d             |%x  |%x    | %d     | %s\n", \
-
-cp 90-cyusb.rules /etc/udev/rules.d
-cp CyUSBSerialCommandUtility /usr/bin/cy-config
-cp CyUSBSerial.sh /usr/bin
-chmod 777 /usr/bin/CyUSBSerial.sh
-    DONE!
-\n\n\nThe TinI/O installation is completed.
- root   master {2} U:2  ~/projekti/CyUSB  ./autobuilder
-    --------------------------
-    Autobuilder for TinI/O 0.1
-    --------------------------
-    Verifying main directory...
-    DONE!
-    Entering the library directory...
-    DONE!
-    Compiling and installing the library...
-gcc -fPIC -g -Wall -o libcyusb.o -c cyusb.c -I ../../common/header
-cyusb.c: In function ‘CyOpen’:
-cyusb.c:556:1: warning: ‘rStatus’ may be used uninitialized in this function [-Wmaybe-uninitialized]
- printf("rstatus6 %d", rStatus);
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gcc -fPIC -g -Wall -o libcyuart.o -c cyuart.c -I ../../common/header
-gcc -fPIC -g -Wall -o libcyi2c.o -c cyi2c.c -I ../../common/header
-gcc -fPIC -g -Wall -o libcyspi.o -c cyspi.c -I ../../common/header
-gcc -fPIC -g -Wall -o libcyphdc.o -c cyphdc.c -I ../../common/header
-gcc -fPIC -g -Wall -o libcyjtag.o -c cyjtag.c -I ../../common/header
-gcc -fPIC -g -Wall -o libcymisc.o -c cymisc.c -I ../../common/header
-gcc -fPIC -g -Wall -o libcyboot.o -c cyboot.c -I ../../common/header
-cyboot.c:72:0: warning: "CY_USB_SERIAL_TIMEOUT" redefined
- #define CY_USB_SERIAL_TIMEOUT 0
-
-In file included from cyboot.c:1:0:
-CyUSBCommon.h:74:0: note: this is the location of the previous definition
- #define CY_USB_SERIAL_TIMEOUT 5000
-
 cyboot.c: In function ‘CyFlashConfigEnable’:
 cyboot.c:634:21: warning: unused variable ‘ioTimeout’ [-Wunused-variable]
      UINT32 rStatus, ioTimeout = CY_USB_SERIAL_TIMEOUT;
@@ -261,10 +146,7 @@ chmod 777 /usr/bin/CyUSBSerial.sh
 
 The TinI/O installation is completed.
 
-
-
-
- +``` If a part of the installation process fails, the script will abort the installation and print out: `Error! The last action autobuild tried to perform failed.` In such case, try also the manual installation described below. If your installation completes succesfully, proceed to the next chapter. @@ -387,3 +269,23 @@ done. ``` If TinI/O installs succesfully, the installation is completed. Proceed to the next chapter. + +# Flashing the board +Before you use your board with TinI/O, you must program its chip with a custom flash that will make the board compatible with TinI/O. The flash files are located in the `/usr/share/tinio/flash` directory and can be flashed to the board with the installed `cy-config` utility. There are 2 flash files with slightly different pin configurations: `5-5.cyusbd` and `3-3cs.cyusbd`. The 5-5 file sets half (5) of the GPIO pins as outputs and the other half as inputs. The 3-3cs sets 3 of the pins as outputs and 4 as inputs and 1 pin as a CapSense capacitive touch button and 1 as its output. See the table for the exact pin configuration: + +| GPIO Pin | 5-5 config | 3-3cs config | +| --- | --- | --- | +| 0 | Input | RESERVED - decouple to ground with a 2n2 capacitor | +| 1 | Input | Input | +| 2 | Input | Capsense button - connect to a metal button surface | +| 3 | Input | Capsense out - connect to an input to read | +| 4 | Input | Input| +| 5 | UART Tx - Don't connect | UART Tx - Don't connect | +| 6 | UART Rx - Don't connect | UART Rx - Don't connect | +| 7 | Output | Input | +| 8 | Output | Output | +| 9 | Output | Output | +| 10 | Output | Output | +| 11 | Output | Input | + +To flash a configuration file diff --git a/tinio/flash/3-3cs_decrypted.cyusbd b/tinio/flash/3-3cs_decrypted.cyusbd old mode 100755 new mode 100644 diff --git a/tinio/flash/5-5_decrypted.cyusbd b/tinio/flash/5-5_decrypted.cyusbd old mode 100755 new mode 100644 diff --git a/tool b/tool deleted file mode 120000 index 08f583f..0000000 --- a/tool +++ /dev/null @@ -1 +0,0 @@ -configutility/linux/testUtility/ \ No newline at end of file diff --git a/configutility/linux/testUtility/90-cyusb.rules b/tool/90-cyusb.rules similarity index 100% rename from configutility/linux/testUtility/90-cyusb.rules rename to tool/90-cyusb.rules diff --git a/configutility/linux/testUtility/Command_Utility.c b/tool/Command_Utility.c similarity index 100% rename from configutility/linux/testUtility/Command_Utility.c rename to tool/Command_Utility.c diff --git a/configutility/linux/testUtility/CyUSBBootloader.h b/tool/CyUSBBootloader.h similarity index 100% rename from configutility/linux/testUtility/CyUSBBootloader.h rename to tool/CyUSBBootloader.h diff --git a/configutility/linux/testUtility/CyUSBSerial.sh b/tool/CyUSBSerial.sh similarity index 100% rename from configutility/linux/testUtility/CyUSBSerial.sh rename to tool/CyUSBSerial.sh diff --git a/configutility/linux/testUtility/CyUSBSerialCommandUtility b/tool/CyUSBSerialCommandUtility similarity index 100% rename from configutility/linux/testUtility/CyUSBSerialCommandUtility rename to tool/CyUSBSerialCommandUtility diff --git a/configutility/linux/testUtility/Makefile b/tool/Makefile similarity index 100% rename from configutility/linux/testUtility/Makefile rename to tool/Makefile diff --git a/configutility/linux/testUtility/README.txt b/tool/README.txt similarity index 100% rename from configutility/linux/testUtility/README.txt rename to tool/README.txt diff --git a/configutility/linux/testUtility/jbiexprt.h b/tool/jbiexprt.h similarity index 100% rename from configutility/linux/testUtility/jbiexprt.h rename to tool/jbiexprt.h diff --git a/configutility/linux/testUtility/jbiport.h b/tool/jbiport.h similarity index 100% rename from configutility/linux/testUtility/jbiport.h rename to tool/jbiport.h