Skip to content

Commit

Permalink
Cascoda SDK patch release v0.23-18
Browse files Browse the repository at this point in the history
Add documentation on using ETS alongside the devkit
Change default channel & baud rate to match devboard expectations for UART builds
  • Loading branch information
tiniuclx committed Jul 13, 2023
1 parent 81705b2 commit 4661dc5
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 67 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,13 @@ jobs:
echo "${{ github.workspace }}/gcc-arm-none-eabi-9-2019-q4-major/bin" >> $GITHUB_PATH
# We configure non-ocf chili build first because building OCF adds bloat to MBedTls, which increases all openthread binary sizes.
- name: configure Chili2S-UART0-1Mbaud
- name: configure Chili2S-UART4-115200baud
run: |
arm-none-eabi-gcc --version
cmake -S ${{ github.workspace }}/cascoda-sdk -B ${{ github.workspace }}/build-chili2 -DCMAKE_TOOLCHAIN_FILE=toolchain/arm_gcc_m2351.cmake -DCASCODA_BM_INTERFACE=UART -DCASCODA_CHILI2_UART_BAUDRATE=1000000 -DCASCODA_CHILI2_UART_CHANNEL=0 -DCASCODA_CHILI2_CONFIG_STRING=ONE_SIDED
cmake -S ${{ github.workspace }}/cascoda-sdk -B ${{ github.workspace }}/build-chili2 -DCMAKE_TOOLCHAIN_FILE=toolchain/arm_gcc_m2351.cmake -DCASCODA_BM_INTERFACE=UART -DCASCODA_CHILI2_UART_BAUDRATE=115200 -DCASCODA_CHILI2_UART_CHANNEL=4 -DCASCODA_CHILI2_CONFIG_STRING=ONE_SIDED
mkdir ${{ github.workspace }}/upload-uart
- name: build Chili2S-UART0-1Mbaud
- name: build Chili2S-UART4-115200baud
run: |
make -C ${{ github.workspace }}/build-chili2 clean
make -C ${{ github.workspace }}/build-chili2 -j4
Expand All @@ -233,7 +233,7 @@ jobs:
repo: Cascoda/cascoda-sdk-priv
workflow: build.yml

# - name: build Chili2S-UART0-1Mbaud-OCF
# - name: build Chili2S-UART4-115200baud-OCF
# run: |
# cmake ${{ github.workspace }}/build-chili2 -DCASCODA_BUILD_OCF=ON -DCASCODA_BUILD_OCF_PKI=ON -DCASCODA_BUILD_SECURE_LWM2M=OFF -DCASCODA_CHILI_FLASH_PAGES=16
# make -C ${{ github.workspace }}/build-chili2 -j4 $OCF_TARGETS
Expand Down Expand Up @@ -299,10 +299,10 @@ jobs:
# fi


- name: Upload Chili2S-UART0-1Mbaud
- name: Upload Chili2S-UART4-115200baud
uses: actions/[email protected]
with:
name: Chili2S-UART0-1Mbaud
name: Chili2S-UART4-115200baud
path: ${{ github.workspace }}/upload-uart

- name: Upload Chili2D-USB
Expand Down Expand Up @@ -370,7 +370,7 @@ jobs:
name: Chili2D-USB
- uses: actions/download-artifact@v1
with:
name: Chili2S-UART0-1Mbaud
name: Chili2S-UART4-115200baud
- uses: actions/download-artifact@v1
with:
name: Posix-SDK
Expand All @@ -390,7 +390,7 @@ jobs:
zip -r CascodaWindowsTools.zip CascodaWindowsTools
zip -r Windows-SDK.zip Windows-SDK
zip -r Chili2D-USB.zip Chili2D-USB
zip -r Chili2S-UART0-1Mbaud.zip Chili2S-UART0-1Mbaud
zip -r Chili2S-UART4-115200baud.zip Chili2S-UART4-115200baud
zip -r Posix-SDK.zip Posix-SDK
zip Chili2-Lib.zip Chili2-Lib/*
Expand Down Expand Up @@ -441,8 +441,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ./Chili2S-UART0-1Mbaud.zip
asset_name: Chili2S-UART0-1Mbaud.zip
asset_path: ./Chili2S-UART4-115200baud.zip
asset_name: Chili2S-UART4-115200baud.zip
asset_content_type: application/zip

- name: Release Posix
Expand Down
4 changes: 4 additions & 0 deletions baremetal/mikrosdk-click/include/motion_click.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
#include <stdint.h>

/* use detection pin as interrupt (1) instead of polling (0) */
#ifndef MOTION_USE_INTERRUPT
#define MOTION_USE_INTERRUPT 0
#endif

/* new state inluding changes or static behaviour */
typedef enum
Expand All @@ -58,7 +60,9 @@ enum motion_status
};

/* timing parameters [ms] */
#ifndef MOTION_T_TONMIN
#define MOTION_T_TONMIN 1000 /* 1 second minimum on time */
#endif

/* new functions */
motion_detect_state_changes_t MIKROSDK_MOTION_get_detected(void);
Expand Down
2 changes: 1 addition & 1 deletion baremetal/mikrosdk-click/source/motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "cascoda-util/cascoda_time.h"

/* flag if alarm / interrupt has been triggered */
static uint8_t motion_alarm = 0;
volatile static uint8_t motion_alarm = 0;

/* declare <device>_t <device> and <device>_cfg_t cfg structures for click objects */
static motion_t motion;
Expand Down
4 changes: 2 additions & 2 deletions baremetal/platform/chili2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ mark_as_advanced(CASCODA_CHILI_DISABLE_CA821x)
if(CASCODA_BM_INTERFACE STREQUAL "UART")
cascoda_dropdown(CASCODA_CHILI2_UART_CHANNEL
"The hardware UART channel to use for UART comms"
0 1 2 4 5
4 0 1 2 5
)
set(CASCODA_CHILI2_UART_BAUDRATE 1000000 CACHE STRING "The baud rate to use for UART. Max 6MHz")
set(CASCODA_CHILI2_UART_BAUDRATE 115200 CACHE STRING "The baud rate to use for UART. Max 6MHz")
if(CASCODA_CHILI2_UART_BAUDRATE GREATER 6000000)
message( FATAL_ERROR "Baud rate must be under 6MHz")
endif()
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/howto-knxiot-devkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ NOTE: This part of the guide will make use of the Cascoda Windows Tools that you

To ensure that the devboards are running the latest firmware, you will have to download the latest firmware and flash it onto both devices.

1. Please [download the latest embedded binaries from our GitHub repository](https://github.com/Cascoda/knx-iot-example/releases/). For this guide, you will need the `embedded_secured.zip` archive.
1. Please [download the latest embedded binaries from our GitHub repository](https://github.com/Cascoda/knx_iot_example/releases/). For this guide, you will need the `embedded_secured.zip` archive.
2. Extract the archive and open a terminal inside the folder containing the binaries - `embedded_secured/build_win_bin/bin`.
3. Inside this terminal, enter the `chilictl list` command.
4. Information about both connected devboards should now be displayed on the screen in this fashion:
Expand Down
113 changes: 64 additions & 49 deletions docs/how-to/howto-knxiot-devkit_knx_tools.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,74 @@
# KNX IoT - Getting Started Guide with KNX tooling

This guide will get you up and running with KNX Tooling! Prior KNX knowledge is needed.
## Step 0: Requirements

Note: this document will change!!.
Please ensure you have the following hardware and software:

## overview
- ETS, version with KNX IoT enabled - ETS 6.1.1 build 5752 or later
- [Cascoda's KNX-IoT Development Kit](https://www.cascoda.com/products/thread-development-kit/)

To use ETS, one has to have product data
You also need to follow the [KNX IoT Getting Started Guide](howto-knxiot-devkit.md). You should have:
- A border router connected to your PC, accessible via Ethernet
- Devboards onboarded onto the Thread & visible on the Network Topology page

| actual devices
V
------- -------
| | | |
| MT | --------> | ETS |
| | product | |
------- data -------
of actual device
## Step 1: Import the Test Project into ETS

The tool to create product data is the MT tool.
The MT tool has a few input files:
Download [the latest test project from the Cascoda GitHub.](https://github.com/Cascoda/knx_iot_example/tree/main/EXAMPLE/MT) and import it into ETS using the Import Project button on the Overview page. Then, open the newly-imported project.

- Application file
- The mask version to use is: KNX IoT
- Hardware file
- Catalog file
## Step 2: Configure the two devices

## Step 0: Requirements
Open the Devices panel by pressing the Panels button in the top left and selecting "Devices". You should now see "KNX Switching Example" device within the list of devices.

Select the KNX Switching example device, and navigate to Properties -> Settings. Here we see that Secure Commissioning is deactivated.

![](imgs/unconfigured-switching-device.png)

Please activate Secure Commissioning, set up a project password and then press Add Device Certificate. Please paste the KNX Device Certificate info of one of the devices into the popup window, and press OK.

![](imgs/qr-code-added.png)

For our development boards, the KNX Device Certificate is printed within Serial Adapter. See the section in the [previous Getting Started guide](howto-knxiot-devkit.md) on getting the KNX QR code string.

Right click on the device inside the Devices panel and select Copy, and then right-click on the Devices button within the same panel and press Paste. Upon doing this, you will be prompted to enter the Device Certificate of this new device. Please paste the KNX Device Certificate of your second device and click OK.

## Step 3: Create an IoT area

Navigate to the Topology panel. Select the Topology Backbone and ensure that the Backbone Medium is set to IP. Press the Add Areas button create a new Area with Medium set to IoT. Then, drag and drop both devices into the newly created IoT area. The end result should look like this:
![](imgs/finished-topology.png)

## Step 4: Configure the group communication

Open the Group Addresses panel, and Add a Main Group. Select the newly added Main Group, navigate to Properties->Settings and ensure Security is set to On. Then, fully expand both devices until you can see the LED_1 actuator and PB_1 sensor functional blocks for both devices. Drag-and-drop the LED_1 functional block of the first device onto the PB_1 block of the second device.

![](imgs/link-with.png)

This will create an association within the main group you have just created, allowing that LED actuator to be controlled by the Push Button sensor it was dropped on.

Repeat the process for the remaining LED & PB pair. You should now have two associations, each linking the LED of one devboard to the push button of the other.
![](imgs/associations.png)

## Step 5: Download the configuration and test the devices

Right click on a Device and select Download All. When prompted to press the Programming Mode button, please press the buttom labeled SW4. Once the download completes, repeat the process for the second device.

You should now be able to press SW1 on either devboard in order to turn on the SW2 LED thanks to the associations created earlier.

## Step 6: Going further

This KNX application may receive updates from time to time. To grab the latest version, [click here](https://github.com/Cascoda/knx_iot_example).

This application just serves as an example to get you familiar with the process of setting up a KNX configuration. We offer a variety of much more sophisticated applications. A [full list of KNX IoT applications is available here](https://github.com/Cascoda/cascoda-sdk/blob/master/docs/how-to/howto-knxiot.md). Note that most of those will require additional hardware, such as e-Paper displays, sensors, etc.

If you would like to get to know the Cascoda SDK better, you may [take a look at the main Readme document](https://github.com/Cascoda/cascoda-sdk/blob/master/README.md)

We also provide [a packet sniffer that is designed to work alongside KNX-IoT](https://www.cascoda.com/products/packet-sniffer/). The sniffer is able to decrypt the OSCORE communications used by KNX-IoT and is therefore an invaluable development tool.

Finally, the [Cascoda SDK Reference document](https://github.com/Cascoda/cascoda-sdk/blob/master/docs/reference/full-reference.md) contains a comprehensive overview of all of our documentation, which includes tutorials, detailed information on using Thread, flashing and debugging using device programmers, system architecture & API reference.

Feel free to [contact us for more information!](mailto:[email protected])

# Appendix: Troubleshooting

## Devices not discovered by ETS

Please ensure you have the following software:

- MT, Manufactorer tool, version with KNX IoT Enabled.
- ETS, version with KNX IoT enabled
- Cascoda's development Kit, see: xxxx
- Devices on the thread network, see xxxx
- border router attached to the PC, see xxx

## Step 1: Creating ETS project with MT

- download the configuration files for the specific application
- or make them by hand
- run manufactorer tool to create project that can be used by ETS
- run MT as batch
- run MT as interactive program:
- Compile the solution
- Export as project as test solution.

## Step 2: Using ETS

To use ETS one has to have:
- actual devices
- (test) project that describes the actual device.

To create a configuration one has to create a topology first:
- backbone is IPV4
- add IoT area to the backbone
- copy devices to the IoT area
- create links between the devices as usual
- download the application (configuration) to the device
In order to access Thread devices, ETS will have to communicate to the external Thread network. In some circumstances, the Windows firewall blocks it. In the Windows search bar, type "Allow an App through Windows Firewall" and select the Control Panel option. Within this interface, please ensure that ETS6 is allowed through on both Private and Public networks.
2 changes: 1 addition & 1 deletion docs/how-to/howto-knxiot-devkit_linker.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Press the button that says SW1 on either of the devboards. This should cause the

## Step 2: Going further

This KNX application may receive updates from time to time. To grab the latest version, [click here](https://github.com/Cascoda/knx-iot-example).
This KNX application may receive updates from time to time. To grab the latest version, [click here](https://github.com/Cascoda/knx_iot_example).

This application just serves as an example to get you familiar with the process of setting up a KNX configuration. We offer a variety of much more sophisticated applications. A [full list of KNX IoT applications is available here](https://github.com/Cascoda/cascoda-sdk/blob/master/docs/how-to/howto-knxiot.md). Note that most of those will require additional hardware, such as e-Paper displays, sensors, etc.

Expand Down
Binary file added docs/how-to/imgs/associations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/how-to/imgs/finished-topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/how-to/imgs/link-with.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/how-to/imgs/qr-code-added.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/reference/cascoda-uart-if.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ The Cascoda SDK contains three implementations of this interface, one for bareme
The underlying UART configuration is flexible, as the higher layer protocol described in this document does not rely on it. In particular, the baud rate is configurable using the ``CASCODA_CHILI2_UART_BAUDRATE`` CMake cache variable for the Chili 2, or the ``CASCODA_UART`` environment variable on Posix systems ([see here](../../posix/ca821x-posix/README.md#uart)).

The Default parameters for the UART using the Chili 2 are:
- 1 000 000 Baud (1MBaud)
- 115 200 Baud
- 8 bit characters
- 1 stop bit
- No hardware flow control
- No parity bit
- UART0 Channel
- UART4 Channel

## Message Structure

Expand Down
2 changes: 1 addition & 1 deletion knx-iot/example/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# KNX IoT Example Application

We host our KNX IoT Example Application [in a separate repository](https://github.com/Cascoda/knx-iot-example).
We host our KNX IoT Example Application [in a separate repository](https://github.com/Cascoda/knx_iot_example).

This is the application which comes programmed by default in our [KNX IoT Development Boards](https://www.cascoda.com/products/thread-development-kit/).

0 comments on commit 4661dc5

Please sign in to comment.