Skip to content

Commit

Permalink
Updated usbip stuff, tweaked software/examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
waynegramlich committed May 24, 2021
1 parent dd9a343 commit 95f6466
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 99 deletions.
2 changes: 1 addition & 1 deletion bin/usbipd.service → bin/usbip_host.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description=usbip host daemon
[Service]
ExecStartPre=/usr/sbin/modprobe usbip-host
ExecStart=/usr/bin/usbipd
ExecStartPost=/usr/local/bin/usbipd.service.sh
ExecStartPost=/usr/local/bin/usbipd_host.service.sh

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion bin/usbipd.service.sh → bin/usbip_host.service.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/bash
log_file=/tmp/usbip_bind.log
echo "/usr/local/bin/usbipd.servce.sh started" > "$log_file"
echo "/usr/local/bin/usbipd_host.servce.sh started" > "$log_file"
/usr/bin/usbip list -p -l 2>&1 >> "$log_file"
st_link_bus_id="$(/usr/bin/usbip list -p -l)"
echo "st_link_bus_id1=$st_link_bus_id" >> "$log_file"
Expand Down
7 changes: 7 additions & 0 deletions electrical/master_board/rev_a/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
* SB7 Closed=>Morpho CN12-10
* Pi 4
* RXD3 Pin 29
33. PB4 is connected to LMOTOR_CTL1. On startup, PB is conne NJTRST and is an output that
is set to high. That causes the right motor to go full speed until the initialization
code gets around to converting into a GPIO in the low state. Pull down resistors do
not help. The pins that do not initialize to floating are described in section 6.3.1
in the reference manual (page 223.) The PA15 and PB4 are not suitable. PB4 is currently
used as TIM3_CH4. The correct thing to a timer that does not use PBB or PBA15 ***AND***
connect pull down resistors to the LMOTOR/RMOTOR_CTL1/2 pins.

<!--
7: TXD3(Pi4) Avail
Expand Down
25 changes: 11 additions & 14 deletions software/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ This section is broken into the following sub-sections:
You get be pick between display/keyboard bring up vs. headless bring up.

* [Install Ubuntu onto a Micro-SD Card](#install-ubuntu-onto-a-micro-sd-card):
A program called `rpi-image` isntalled onto your development computer and
A program called `rpi-imager` installed onto your development computer and
is used to load the Ubuntu image for the Raspberry Pi4 onto a micro-SD card.

* [Raspberry Pi 4 Connector Locations](#raspberry-pi-4-connector-locations):
Expand Down Expand Up @@ -934,10 +934,7 @@ In the script below, substitute your new account name for `NEWUSER`:
Give the new account super-user capability with the following command:

sudo usermod -aG sudo NEWUSER

<!--
sudo usermod -a -G dialout wayne
-->
sudo usermod -aG dialout NEWUSER

<!--
Issue: It did not set default directory to /home/NEWUSER .
Expand Down Expand Up @@ -1120,30 +1117,30 @@ The Robot computer needs to do three things on start-up.

This is done with two files:

* `/etc/systemd/system/usbipd.service`:
* `/etc/systemd/system/usbip-host.service`:
This is a `systemd` unit file that properly installs the kernel modules
and runs the daemon.
It also invokes the `usbipd.service.sh` shell file immediately below.
It also invokes the `usbip-host.service.sh` shell file immediately below.

* `/usr/local/bin/usbip_host.service.sh`:
This determines if an ST-Link plugged into one of the robot computer USB ports and
(if present) bind it such that it is available for external access.

The is installed as super user:
The file is installed as super user:

sudo -s # If prompted for a password, type it in.
# Prompt character changes from `>` to `#` to remind you that your are super-user

Now install `/etc/systemd/system/usbipd.service` as follows:

cd /etc/systemd/system
wget https://raw.githubusercontent.com/hbrobotics/hbrc_ros_robot_platform/master/bin/usbipd.service
wget https://raw.githubusercontent.com/hbrobotics/hbrc_ros_robot_platform/master/bin/usbip_host.service

Now install `/usr/local/bin/usbipd.service.sh` as follows:
Now install `/usr/local/bin/usbip_host.service.sh` as follows:

cd /usr/local/bin
wget https://raw.githubusercontent.com/hbrobotics/hbrc_ros_robot_platform/master/bin/usbipd.service.sh
chmod +x usbipd.service.sh
chmod +x usbip_host.service.sh

###### Verify `usbip` Installation

Expand All @@ -1153,7 +1150,7 @@ Plug a USB-A to USB-micro cable between the Robot Computer and the Robot Microco
Verify that both files exist:

ls -l /etc/systemd/system/usbip_host.service # Should print a one line directory listing
ls -l /usr/local/bin/usbipd_host.service.sh # Should print a one line directory listing
ls -l /usr/local/bin/usbipd.service.sh # Should print a one line directory listing

Now enable/start the service:

Expand Down Expand Up @@ -1274,7 +1271,7 @@ The next major step is to install ROS2 on the robot computer

### Robot Computer ROS2 Installation

The intial installaton of ROS2 is pretty straight forward.
The initial installation of ROS2 is pretty straight forward.
The steps are:

1. [Connect to ROS2 PPA](#connect-to-ros2-ppa):
Expand All @@ -1290,7 +1287,7 @@ The steps are:

The ROS2 instructions for connecting to the ROS2 PPA are a little more involved
than the instructions immediately below.
The insturctions use `apt-key` rather than `curl`:
The instructions use `apt-key` rather than `curl`:

sudo apt-key adv --fetch-keys https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc
sudo apt-add-repository http://packages.ros.org/ros2/ubuntu
Expand Down
15 changes: 9 additions & 6 deletions software/blinky/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOG_CLK_ENABLE();

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, LD1_Pin|LD3_Pin|LD2_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, LD1_Pin|LD3_Pin|LMOTOR_CTL1_Pin|LMOTOR_CTL2_Pin
|LD2_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(USB_PowerSwitchOn_GPIO_Port, USB_PowerSwitchOn_Pin, GPIO_PIN_RESET);
Expand All @@ -288,18 +289,20 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pins : LD1_Pin LD3_Pin LD2_Pin */
GPIO_InitStruct.Pin = LD1_Pin|LD3_Pin|LD2_Pin;
/*Configure GPIO pins : LD1_Pin LD3_Pin LMOTOR_CTL1_Pin LMOTOR_CTL2_Pin
LD2_Pin */
GPIO_InitStruct.Pin = LD1_Pin|LD3_Pin|LMOTOR_CTL1_Pin|LMOTOR_CTL2_Pin
|LD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/*Configure GPIO pins : RMOTOR_CTL2_Pin LMOTOR_CTL1_Pin LMOTOR_CTL2_Pin */
GPIO_InitStruct.Pin = RMOTOR_CTL2_Pin|LMOTOR_CTL1_Pin|LMOTOR_CTL2_Pin;
/*Configure GPIO pin : RMOTOR_CTL2_Pin */
GPIO_InitStruct.Pin = RMOTOR_CTL2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(RMOTOR_CTL2_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : RMII_TXD1_Pin */
GPIO_InitStruct.Pin = RMII_TXD1_Pin;
Expand Down
Loading

0 comments on commit 95f6466

Please sign in to comment.