mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
atlflight/eagle: minor fixes to get it running again
- fixed df_ltc2946_wrapper battery dependency - fixed px4::atomic fetch_add for QuRT - updated PX4 QuRT SPI wrapper to set bus frequency - renamed "qurt-default" configs to just "qurt"
This commit is contained in:
@@ -44,7 +44,7 @@ pipeline {
|
|||||||
]
|
]
|
||||||
|
|
||||||
def snapdragon_builds = [
|
def snapdragon_builds = [
|
||||||
target: ["atlflight_eagle_qurt-default", "atlflight_eagle_default"],
|
target: ["atlflight_eagle_qurt", "atlflight_eagle_default"],
|
||||||
image: docker_images.snapdragon,
|
image: docker_images.snapdragon,
|
||||||
archive: false
|
archive: false
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -223,10 +223,10 @@ posix_sitl_default:
|
|||||||
.PHONY: all posix px4_sitl_default all_config_targets all_default_targets
|
.PHONY: all posix px4_sitl_default all_config_targets all_default_targets
|
||||||
|
|
||||||
# Multi- config targets.
|
# Multi- config targets.
|
||||||
eagle_default: atlflight_eagle_default atlflight_eagle_qurt-default
|
eagle_default: atlflight_eagle_default atlflight_eagle_qurt
|
||||||
eagle_rtps: atlflight_eagle_rtps atlflight_eagle_qurt-rtps
|
eagle_rtps: atlflight_eagle_rtps atlflight_eagle_qurt-rtps
|
||||||
|
|
||||||
excelsior_default: atlflight_excelsior_default atlflight_excelsior_qurt-default
|
excelsior_default: atlflight_excelsior_default atlflight_excelsior_qurt
|
||||||
excelsior_rtps: atlflight_excelsior_rtps atlflight_excelsior_qurt-rtps
|
excelsior_rtps: atlflight_excelsior_rtps atlflight_excelsior_qurt-rtps
|
||||||
|
|
||||||
.PHONY: eagle_default eagle_rtps
|
.PHONY: eagle_default eagle_rtps
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ px4_add_board(
|
|||||||
PLATFORM qurt
|
PLATFORM qurt
|
||||||
VENDOR atlflight
|
VENDOR atlflight
|
||||||
MODEL eagle
|
MODEL eagle
|
||||||
LABEL qurt-default
|
LABEL qurt
|
||||||
DRIVERS
|
DRIVERS
|
||||||
barometer/bmp280
|
barometer/bmp280
|
||||||
gps
|
gps
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
minidm.log
|
||||||
|
px4.log
|
||||||
@@ -147,7 +147,7 @@ installpx4() {
|
|||||||
# Reboot the target before beginning the installation
|
# Reboot the target before beginning the installation
|
||||||
echo -e "Rebooting the target..."
|
echo -e "Rebooting the target..."
|
||||||
adb reboot
|
adb reboot
|
||||||
adb wait-for-devices
|
adb wait-for-usb-device
|
||||||
# Wait a bit longer after bootup, before copying binaries to the target.
|
# Wait a bit longer after bootup, before copying binaries to the target.
|
||||||
sleep 30
|
sleep 30
|
||||||
adb devices
|
adb devices
|
||||||
@@ -157,8 +157,8 @@ installpx4() {
|
|||||||
if [ $mode == 0 ]; then
|
if [ $mode == 0 ]; then
|
||||||
# copy default binaries
|
# copy default binaries
|
||||||
echo -e "Copying the PX4 binaries from the eagle_default build tree..."
|
echo -e "Copying the PX4 binaries from the eagle_default build tree..."
|
||||||
adb push $workspace/build/atlflight_eagle_qurt-default/platforms/qurt/libpx4.so /usr/share/data/adsp
|
adb push $workspace/build/atlflight_eagle_qurt/platforms/qurt/libpx4.so /usr/share/data/adsp
|
||||||
adb push $workspace/build/atlflight_eagle_qurt-default/platforms/qurt/libpx4muorb_skel.so /usr/share/data/adsp
|
adb push $workspace/build/atlflight_eagle_qurt/platforms/qurt/libpx4muorb_skel.so /usr/share/data/adsp
|
||||||
adb push $workspace/build/atlflight_eagle_default/bin/px4 /home/linaro
|
adb push $workspace/build/atlflight_eagle_default/bin/px4 /home/linaro
|
||||||
adb push $workspace/posix-configs/eagle/flight/px4.config /usr/share/data/adsp
|
adb push $workspace/posix-configs/eagle/flight/px4.config /usr/share/data/adsp
|
||||||
adb push $workspace/posix-configs/eagle/flight/mainapp.config /home/linaro
|
adb push $workspace/posix-configs/eagle/flight/mainapp.config /home/linaro
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ px4_add_board(
|
|||||||
PLATFORM qurt
|
PLATFORM qurt
|
||||||
VENDOR atlflight
|
VENDOR atlflight
|
||||||
MODEL excelsior
|
MODEL excelsior
|
||||||
LABEL qurt-default
|
LABEL qurt
|
||||||
DRIVERS
|
DRIVERS
|
||||||
barometer/bmp280
|
barometer/bmp280
|
||||||
gps
|
gps
|
||||||
@@ -105,7 +105,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline T fetch_add(T num)
|
inline T fetch_add(T num)
|
||||||
{
|
{
|
||||||
|
#ifdef __PX4_QURT
|
||||||
|
// TODO: fix
|
||||||
|
return _value++;
|
||||||
|
#else
|
||||||
return __atomic_fetch_add(&_value, num, __ATOMIC_SEQ_CST);
|
return __atomic_fetch_add(&_value, num, __ATOMIC_SEQ_CST);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -46,7 +46,13 @@ else()
|
|||||||
modules__muorb__adsp
|
modules__muorb__adsp
|
||||||
${module_libraries}
|
${module_libraries}
|
||||||
${df_driver_libs}
|
${df_driver_libs}
|
||||||
|
df_driver_framework
|
||||||
m
|
m
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# board defined upload helper
|
||||||
|
if(EXISTS "${PX4_BOARD_DIR}/cmake/upload.cmake")
|
||||||
|
include(${PX4_BOARD_DIR}/cmake/upload.cmake)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include <lib/parameters/param.h>
|
#include <lib/parameters/param.h>
|
||||||
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>
|
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>
|
||||||
|
|
||||||
int px4_platform_init(void)
|
int px4_platform_init()
|
||||||
{
|
{
|
||||||
hrt_init();
|
hrt_init();
|
||||||
|
|
||||||
|
|||||||
@@ -42,4 +42,5 @@ px4_add_module(
|
|||||||
git_driverframework
|
git_driverframework
|
||||||
df_driver_framework
|
df_driver_framework
|
||||||
df_ltc2946
|
df_ltc2946
|
||||||
|
battery
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -39,4 +39,3 @@ px4_add_module(
|
|||||||
qshell.cpp
|
qshell.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -140,10 +140,10 @@ SPI::transfer(uint8_t *send, uint8_t *recv, unsigned len)
|
|||||||
|
|
||||||
if (result != (int)len) {
|
if (result != (int)len) {
|
||||||
PX4_ERR("write failed. Reported %d bytes written (%s)", result, strerror(errno));
|
PX4_ERR("write failed. Reported %d bytes written (%s)", result, strerror(errno));
|
||||||
return -1;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -183,10 +183,10 @@ SPI::transferhword(uint16_t *send, uint16_t *recv, unsigned len)
|
|||||||
|
|
||||||
if (result != (int)(len * 2)) {
|
if (result != (int)(len * 2)) {
|
||||||
PX4_ERR("write failed. Reported %d bytes written (%s)", result, strerror(errno));
|
PX4_ERR("write failed. Reported %d bytes written (%s)", result, strerror(errno));
|
||||||
return -1;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace device
|
} // namespace device
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "dev_fs_lib_spi.h"
|
#include "dev_fs_lib_spi.h"
|
||||||
|
|
||||||
#include <px4_platform_common/px4_config.h>
|
#include <px4_platform_common/px4_config.h>
|
||||||
@@ -79,7 +80,7 @@ SPI::init()
|
|||||||
{
|
{
|
||||||
// Open the actual SPI device
|
// Open the actual SPI device
|
||||||
char dev_path[16];
|
char dev_path[16];
|
||||||
snprintf(dev_path, sizeof(dev_path), "dev/spi-%lu", PX4_SPI_DEV_ID(_device));
|
snprintf(dev_path, sizeof(dev_path), DEV_FS_SPI_DEVICE_TYPE_STRING"%lu", PX4_SPI_DEV_ID(_device));
|
||||||
DEVICE_DEBUG("%s", dev_path);
|
DEVICE_DEBUG("%s", dev_path);
|
||||||
_fd = ::open(dev_path, O_RDWR);
|
_fd = ::open(dev_path, O_RDWR);
|
||||||
|
|
||||||
@@ -117,7 +118,29 @@ SPI::transfer(uint8_t *send, uint8_t *recv, unsigned len)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set bus frequency
|
||||||
|
dspal_spi_ioctl_set_bus_frequency bus_freq{};
|
||||||
|
|
||||||
|
bus_freq.bus_frequency_in_hz = _frequency;
|
||||||
|
|
||||||
|
if (::ioctl(_fd, SPI_IOCTL_SET_BUS_FREQUENCY_IN_HZ, &bus_freq) < 0) {
|
||||||
|
PX4_ERR("setting bus frequency failed");
|
||||||
|
return PX4_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set bus mode
|
||||||
|
// dspal_spi_ioctl_set_spi_mode bus_mode{};
|
||||||
|
// bus_mode.eClockPolarity = SPI_CLOCK_IDLE_HIGH;
|
||||||
|
// bus_mode.eShiftMode = SPI_OUTPUT_FIRST;
|
||||||
|
|
||||||
|
// if (::ioctl(spi_fildes, SPI_IOCTL_SET_SPI_MODE, &bus_mode) < 0) {
|
||||||
|
// PX4_ERR("setting mode failed");
|
||||||
|
// return PX4_ERROR;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// transfer data
|
||||||
dspal_spi_ioctl_read_write ioctl_write_read{};
|
dspal_spi_ioctl_read_write ioctl_write_read{};
|
||||||
|
|
||||||
ioctl_write_read.read_buffer = send;
|
ioctl_write_read.read_buffer = send;
|
||||||
ioctl_write_read.read_buffer_length = len;
|
ioctl_write_read.read_buffer_length = len;
|
||||||
ioctl_write_read.write_buffer = recv;
|
ioctl_write_read.write_buffer = recv;
|
||||||
@@ -127,10 +150,10 @@ SPI::transfer(uint8_t *send, uint8_t *recv, unsigned len)
|
|||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
PX4_ERR("transfer error %d", result);
|
PX4_ERR("transfer error %d", result);
|
||||||
return result;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -140,15 +163,28 @@ SPI::transferhword(uint16_t *send, uint16_t *recv, unsigned len)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// int bits = 16;
|
// set bus frequency
|
||||||
// result = ::ioctl(_fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
|
dspal_spi_ioctl_set_bus_frequency bus_freq{};
|
||||||
|
bus_freq.bus_frequency_in_hz = _frequency;
|
||||||
|
|
||||||
// if (result == -1) {
|
if (::ioctl(_fd, SPI_IOCTL_SET_BUS_FREQUENCY_IN_HZ, &bus_freq) < 0) {
|
||||||
// PX4_ERR("can’t set 16 bit spi mode");
|
PX4_ERR("setting bus frequency failed");
|
||||||
|
return PX4_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set bus mode
|
||||||
|
// dspal_spi_ioctl_set_spi_mode bus_mode{};
|
||||||
|
// bus_mode.eClockPolarity = SPI_CLOCK_IDLE_HIGH;
|
||||||
|
// bus_mode.eShiftMode = SPI_OUTPUT_FIRST;
|
||||||
|
|
||||||
|
// if (::ioctl(spi_fildes, SPI_IOCTL_SET_SPI_MODE, &bus_mode) < 0) {
|
||||||
|
// PX4_ERR("setting mode failed");
|
||||||
// return PX4_ERROR;
|
// return PX4_ERROR;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// transfer data
|
||||||
dspal_spi_ioctl_read_write ioctl_write_read{};
|
dspal_spi_ioctl_read_write ioctl_write_read{};
|
||||||
|
|
||||||
ioctl_write_read.read_buffer = send;
|
ioctl_write_read.read_buffer = send;
|
||||||
ioctl_write_read.read_buffer_length = len * 2;
|
ioctl_write_read.read_buffer_length = len * 2;
|
||||||
ioctl_write_read.write_buffer = recv;
|
ioctl_write_read.write_buffer = recv;
|
||||||
@@ -158,10 +194,10 @@ SPI::transferhword(uint16_t *send, uint16_t *recv, unsigned len)
|
|||||||
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
PX4_ERR("transfer error %d", result);
|
PX4_ERR("transfer error %d", result);
|
||||||
return result;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return PX4_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace device
|
} // namespace device
|
||||||
|
|||||||
Reference in New Issue
Block a user