I have a STM32F765 on a PixHawk4 Mini Board. I'm able to program the board with a blinking led example but I failed so far to get an usb serial example to work.
[97108.784299] usb 2-1.2: new full-speed USB device number 70 using ehci-pci
[97108.957752] usb 2-1.2: New USB device found, idVendor=26ac, idProduct=0032, bcdDevice= 1.01
[97108.957760] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[97108.957764] usb 2-1.2: Product: PX4 BL FMU v5.x
[97108.957767] usb 2-1.2: Manufacturer: 3D Robotics
[97108.957769] usb 2-1.2: SerialNumber: 0
[97108.958677] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[97112.724298] usb 2-1.2: reset full-speed USB device number 70 using ehci-pci
[97112.844298] usb 2-1.2: device descriptor read/64, error -32
[97113.074330] usb 2-1.2: device descriptor read/64, error -32
[97113.304303] usb 2-1.2: reset full-speed USB device number 70 using ehci-pci
[97113.414299] usb 2-1.2: device descriptor read/64, error -32
[97113.634302] usb 2-1.2: device descriptor read/64, error -32
[97113.854318] usb 2-1.2: reset full-speed USB device number 70 using ehci-pci
[97114.304302] usb 2-1.2: device not accepting address 70, error -32
[97114.404295] usb 2-1.2: reset full-speed USB device number 70 using ehci-pci
[97114.844297] usb 2-1.2: device not accepting address 70, error -32
[97114.844730] usb 2-1.2: USB disconnect, device number 70
[97114.954305] usb 2-1.2: new full-speed USB device number 71 using ehci-pci
[97115.054295] usb 2-1.2: device descriptor read/64, error -32
[97115.284299] usb 2-1.2: device descriptor read/64, error -32
[97115.504310] usb 2-1.2: new full-speed USB device number 72 using ehci-pci
[97115.604307] usb 2-1.2: device descriptor read/64, error -32
[97115.824302] usb 2-1.2: device descriptor read/64, error -32
[97115.944456] usb 2-1-port2: attempt power cycle
[97116.604295] usb 2-1.2: new full-speed USB device number 73 using ehci-pci
[97117.054298] usb 2-1.2: device not accepting address 73, error -32
[97117.154317] usb 2-1.2: new full-speed USB device number 74 using ehci-pci
[97117.594312] usb 2-1.2: device not accepting address 74, error -32
[97117.594467] usb 2-1-port2: unable to enumerate USB device
USB works in principal because I can use the bootloader to flash my programs.
The changes I made to the example are:
diff --git a/Cargo.lock b/Cargo.lock
index 23b578b..adf3d4d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -710,6 +710,15 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+[[package]]
+name = "stm32-fmc"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf16ee9bd5de754482883cf3eac9a49eb862baf1420f55ce408e001705e9ae74"
+dependencies = [
+ "embedded-hal",
+]
+
[[package]]
name = "stm32-log"
version = "0.1.0"
@@ -784,6 +793,7 @@ dependencies = [
"nb 0.1.3",
"rand_core 0.6.3",
"rtcc",
+ "stm32-fmc",
"stm32f7",
"synopsys-usb-otg",
"void",
diff --git a/example-f723e-disco-board/Cargo.toml b/example-f723e-disco-board/Cargo.toml
index 4a3ceee..77358b4 100644
--- a/example-f723e-disco-board/Cargo.toml
+++ b/example-f723e-disco-board/Cargo.toml
@@ -8,7 +8,7 @@ edition = "2018"
panic-halt = "0.2.0"
cortex-m = "0.7.4"
cortex-m-rt = "0.7.1"
-stm32f7xx-hal = { version = "0.6.0", features = ["stm32f723"] }
+stm32f7xx-hal = { version = "0.6.0", features = ["stm32f767"] }
nb = "0.1.2"
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
panic-rtt-target = { version = "0.1.2", features = ["cortex-m"] }
diff --git a/example-f723e-disco-board/examples/serial.rs b/example-f723e-disco-board/examples/serial.rs
index cf47386..789f49a 100644
--- a/example-f723e-disco-board/examples/serial.rs
+++ b/example-f723e-disco-board/examples/serial.rs
@@ -26,8 +26,8 @@ fn main() -> ! {
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr
- .hse(HSEClock::new(25.MHz(), HSEClockMode::Bypass))
- .sysclk(72.MHz())
+ .hse(HSEClock::new(16.MHz(), HSEClockMode::Oscillator))
+ .sysclk(216.MHz())
.freeze();
let gpioa = dp.GPIOA.split();
@@ -67,6 +67,7 @@ fn main() -> ! {
#[cfg(feature = "hs")]
let builder = builder.max_packet_size_0(64);
let mut usb_dev = builder.build();
+ usb_dev.force_reset();
loop {
if !usb_dev.poll(&mut [&mut serial]) {
diff --git a/example-f723e-disco-board/memory.x b/example-f723e-disco-board/memory.x
index 3e1f981..dd71ca5 100644
--- a/example-f723e-disco-board/memory.x
+++ b/example-f723e-disco-board/memory.x
@@ -1,6 +1,16 @@
-/* STM32F723IEK6 */
+/*
+ For STM32F765 device with offset for PX4 bootloader
+*/
MEMORY
{
- FLASH : ORIGIN = 0x08000000, LENGTH = 512k
- RAM : ORIGIN = 0x20000000, LENGTH = 256k
+ /* NOTE K = KiBi = 1024 bytes */
+ /* reserve up to 32K for the PX4 bootloader: */
+ BL_FLASH : ORIGIN = 0x08000000, LENGTH = 32K
+ FLASH : ORIGIN = 0x8008000, LENGTH = 2M - 32K
+ RAM : ORIGIN = 0x20000000, LENGTH = 368K + 16K
}
+
+/* This is where the call stack will be allocated. */
+/* The stack is of the full descending type. */
+/* NOTE Do NOT modify `_stack_start` unless you know what you are doing */
+_stack_start = ORIGIN(RAM) + LENGTH(RAM);
I'm new to the ecosystem. Maybe I make a stupid mistake. Help much appreciated.
Hi,
I have a STM32F765 on a PixHawk4 Mini Board. I'm able to program the board with a blinking led example but I failed so far to get an usb serial example to work.
I used the example-f723e-disco-board/examples/serial.rs as a base for my tests but could get this to work. My host kernel reports the following problems:
USB works in principal because I can use the bootloader to flash my programs.
The changes I made to the example are:
I'm new to the ecosystem. Maybe I make a stupid mistake. Help much appreciated.
Thanks for your time.
Best Philipp