- Русские Блоги
- Как протестировать и проверить интерфейс CAN под Linux
- Предисловие
- окружение
- Метод работы
- 1. Найдите узел CAN
- 2. Настройте узел банки.
- 3. Просмотрите состояние узла банки.
- 4. Отправлять и получать баночные сообщения.
- В конце концов
- Остающаяся проблема
- Tutorial – Wekan
- Installation
- Initial Configuration
- Columns, Cards, and WIPs
Русские Блоги
Как протестировать и проверить интерфейс CAN под Linux
Предисловие
Как удобно протестировать и проверить интерфейс CAN во встроенном Linux — это проблема. Фактически, в системе Linux есть собственные программные инструменты для тестирования и проверки.
окружение
Оборудование: NXP IMX6Solox, Kvaser Can Card
Программное обеспечение: встроенный Linux, терминал управления последовательным портом, Kvaser CanKing
Используйте 2 провода для вывода CAN L и CAN H и подключения к карте CAN.
Метод работы
1. Найдите узел CAN
# ifconfig -a can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:30 can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:16 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:31 eth0 Link encap:Ethernet HWaddr 72:5B:8C:6D:BF:77 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Если привод исправен, вы можете увидеть узел банки (can0 и can1 на рисунке выше).
2. Настройте узел банки.
Возьмем для примера узел can0
ifconfig can0 down ip link set can0 type can bitrate 500000 triple-sampling on ifconfig can0 up
3. Просмотрите состояние узла банки.
ip -details link show can0
# ip -details link show can0 2: can0: mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10 link/can promiscuity 0 can state STOPPED (berr-counter tx 0 rx 0) restart-ms 0 flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1 flexcan: dtseg1 1..39 dtseg2 1..8 dsjw 1..8 dbrp 1..1024 dbrp-inc 1 clock 30000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
4. Отправлять и получать баночные сообщения.
Отправить сообщение: cansend;
# cansend can0 123#000102030405060708
Получать сообщения: candump
# candump can0 can0 001 [8] 01 02 03 04 05 06 07 08 can0 001 [8] 01 02 03 04 05 06 07 08 can0 001 [8] 01 02 03 04 05 06 07 08 can0 001 [8] 01 02 03 04 05 06 07 08
В конце концов
Linux предоставляет полный набор инструментов программного обеспечения для жестяных банок, который значительно облегчает тестирование и проверку консервных банок.
Остающаяся проблема
1. Какой API используется для отправки и чтения CAN сообщений в Linux?
2. Почему система CAN под Linux устроена так?
Tutorial – Wekan
Wekan lets self-organzing teams manage a project’s workflow by tracking task ownership and progress visually.
Kanban, the Japanese word for signboard, is a workflow management system for organizing and tracking work. Kanban boards show team members the status of each task at any given time, including ownership and task order, with the aim of limiting the number of tasks «in progress» at any given time.
First developed in the 1980s to improve the efficiency of Toyota’s assembly lines [1], kanban has proven its usefulness as a general-purpose organization tool. Today, people use kanban for everything from simple personal to-do lists to coordinating teams that produce complex goods or services.
The original kanban boards were physical boards attached to factory or office walls. While many people still use physical kanban boards (even if it’s just on paper), a variety of kanban board software tools exist (see also the «Scrum vs. Kanban» box). Before using any type of kanban system, I recommend reading why some people still choose physical kanban boards [3].
In the past few decades, the need to organize work with computers, possibly online, has resulted in a wide range of organizational tools. You may be familiar with Scrum [2], a work organization method that looks similar to kanban. Both tools have the same high-level purpose. There are, however, several important differences between Scrum and kanban boards. To begin with, while both methods are meant to support self-organizing work teams, Scrum uses formal roles, whereas kanban doesn’t use them at all. Furthermore, a kanban board is always «active,» as long as the project is produced or maintained. Scrum boards, instead, are created only when needed, to perform specific tasks in «sprints» that have precise, often quite pressing deadlines.
In this tutorial, I take a look at Wekan [4], an open source, MIT-licensed, web-based kanban system. Written with the Meteor Javascript framework [5] and using a MongoDB database, Wekan runs on any web browser. I’ll show you how to install and use Wekan using general kanban principles.
Installation
You can download the Wekan source code, as well as Snap packages for several Linux distributions, from the Wekan website [4]. Alternatively, you could use Wekan as an application inside the open source Sandstorm platform for self-hosting web apps [6].
Although the process is not complicated, installing Wekan and all its dependencies from scratch on a dedicated server can be a lengthy process with a lot of details. I don’t have the space to cover installing Wekan from source here, but an online tutorial written for CentOS 7 can point you in the right direction [7]. Though not completely up to date, the CentOS tutorial is very detailed and an excellent addition to the official Wekan documentation, regardless of your distribution.
If you don’t need to install from source code, the Snap packages are much easier to use. On Ubuntu, you can run
sudo snap install wekan sudo snap set wekan port="3500" sudo snap enable wekan
at the prompt to install Wekan v5.37.0 and tell Wekan to answer connection requests on IP port number 3500. After installation, if you want to connect to Wekan from the same host, you must point your browser to the location http://localhost:$IP_PORT, where $IP_PORT is the parameter value you set in the second command above. I chose port 3500, but any port will do as long as it is not already used by another service on the same host. The final command above tells Linux to start Wekan automatically at bootup.
For this tutorial, I ran Wekan on my main Linux computer. If you need your installation to be accessible from the Internet, Wekan will also need to know the URL it should answer to, and you will have to open the corresponding IP port in the server firewall (please consult your firewall’s documentation for instructions). The URL can be set with just one more snap command:
sudo snap set wekan root-url="https://wekan.example.com"
Initial Configuration
When you first connect to your Wekan installation, you must create at least one user account. Next, you need to configure several system-wide features, including email configuration, which allows Wekan to notify users whenever something happens associated with their accounts (see the Wekan wiki [8] for instructions).
After configuring email, you may want to customize parameters found in the Admin Panel’s Registration, Accounts, and Layout tabs (Figure 1). You can allow (or forbid) self-registration. Existing users can also be given permission to change their personal Wekan account’s primary data (i.e, username and email). In the Layout tab, you can define a clickable logo with a custom URL, as well as a few other cosmetic details.
Figure 1: The Wekan Admin Panel settings are simple but functional.
Potentially very interesting, Global Webhooks lets you define site-wide hooks that automatically notify external applications of something that happened inside Wekan or load data from external applications. You can also define board-specific webhooks. Unfortunately, at the time of writing, this feature is not adequately documented to be easily usable without spending significant time studying the code or hunting for answers in the Wekan support forum. However, webhooks may not be needed at all by the majority of projects that use Wekan.
A single Wekan installation supports multiple users who can be grouped into separate organizations, each composed of different teams (Figure 2). Figure 3 shows configuration options for an organization, and Figure 4 shows the team options.
Figure 2: One kanban to rule them all: Wekan supports independent organizations consisting of teams and individual users.
Figure 3: The New Organization dialog.
Figure 4: The New Team dialog.
Columns, Cards, and WIPs
Regardless of the type of project, all kanban boards should support, at a minimum, three types of components: columns, cards, and Work In Progress (WIP) limits.
A column, or a list, in Wekan lingo, defines a specific activity or phase of the entire workflow. For instance, a restaurant may have columns that indicate each client’s current status: a list for clients waiting for their orders and another list for clients being actively served. The simplest possible workflow in most cases probably contains only three lists: To-Do, In Progress, and Finished. However, every project can create as many lists as needed and name them in whatever way makes their function clear to the whole team.
A card contains a single task managed on a kanban board. Each card moves through the columns in the workflow as a given tasks progresses toward completion. In most kanban systems, including Wekan, you can share the workload by explicitly assigning team members to specific cards. To make things even clearer, Wekan lets you attach colored labels to cards, allowing you to group or sort and filter the cards by title, creation date, or due date.
The WIP limit defines the maximum number of cards that can be in one column at any given time, in other words, the maximum number of tasks that the team allows itself to have in that particular state at any given moment. When the number of cards in a column exceeds the WIP limit, anyone responsible for any of the cards must focus to complete those tasks and move them to the next column before other cards begin to pile up in that column. In my opinion, the WIP limit is the kanban method’s core strength. Make the WIP limit an adequate value for your team and project, which of course only you can estimate, and life will be good as long as everyone respects the limit. If the WIP limit is ignored, problems could arise. A WIP limit set too low results in unrealistic expectations and unnecessary stress. In contrast, a value set too high, even in just one column, can slow down the entire workflow represented on the board.
In Wekan, you can create and use several boards simultaneously (each containing a separate project) and set each of them as public or private (Figure 5). Once you have created a board, click on the plus sign at the bottom to add as many lists (columns) as you want to the board. After attaching a list to the board, you can (and should) assign a separate color to the list, but most importantly, you should define a list’s WIP limit. Each list can have a different WIP value, set as either a hard or soft limit. A soft limit means the limit can be exceeded, but a warning will be given. After you have created all your lists, you can rearrange them by dragging and dropping them inside the board. You can also rename a list by selecting it and then clicking again on its name.
Figure 5: Wekan supports both public and private kanban boards.