Commit Graph

3806 Commits

Author SHA1 Message Date
bors[bot]
7e251a2550
Merge #1180
1180: usb: allow adding isochronous endpoints r=Dirbaio a=nitroxis

This adds (basic) support for isochronous endpoints. In theory, isochronous endpoints have guaranteed bandwidths and are support to adhere to strict timings. But it seems that nothing bad happens if you don't follow the specs closely in this regard. Better handling could also still be added in the future.

Co-authored-by: nitroxis <n@nxs.re>
2023-01-27 15:06:35 +00:00
Samuel Tardieu
e453334870 LoRa/SX1276: adjust Rx window offset and duration
After a transmission, two receive windows Rx1 and Rx2 are opened
for one second each, one right after the other, after a fixed delay
(for example 5s). The Rx window offset is added to the starting date
of each window and the Rx window duration represents the maximum
delay we will wait for an incoming message before declaring that
a timeout occurred.

A value of -500ms for the offset and 800ms for the duration means
that instead of having Rx1 = [5000, 6000[ and Rx2 = [6000, 7000[
we get Rx1 = [4500, 5300[ and Rx2 = [5500, 6300[. We only cover
30% of the expected windows.

The maximum time a SX127x can take before the Rx side is ready is
TS_HOP + TS_RE = 50µs + 2.33ms. Using 3ms for the offset and
1003ms for the duration will give much better time windows:
Rx1 = [4997, 5997[ and Rx2 = [5997, 7000]. Note that the
lorawan-device crate caps Rx1 end date to Rx2 start date.

This change allows a previously failing Murata CMWX1ZZABZ-091
module (STM32L + SX1276) to connect to the TTN LoRa network.
2023-01-27 16:01:41 +01:00
nitroxis
c9e2cd6dd4 usb: allow adding isochronous endpoints 2023-01-27 15:53:13 +01:00
bors[bot]
7ec15f2def
Merge #1178
1178: rp: allow isochronous USB endpoints to be up to 1023 bytes in size r=Dirbaio a=nitroxis

The datasheet allows isochronous USB endpoints to be up to 1023 bytes in size (see "4.1.2.5. DPSRAM"). This PR changes the check to allow this and also changes the length computation to align to 64 bytes (instead of hardcoded 64 bytes).

Embassy does not yet support isochronous USB endpoints, however I'm investigating adding support. This change is simple enough and should be correct according to the datasheet, so maybe future implementers don't run into this issue.

Co-authored-by: nitroxis <n@nxs.re>
2023-01-27 14:44:51 +00:00
nitroxis
1e60c60afd rp: allow isochronous USB endpoints to be up to 1023 in size 2023-01-27 07:24:49 +01:00
ivmarkov
34b67fe137 STD driver needs a reentrant mutex; logic fixed to be reentrancy-safe 2023-01-26 20:41:18 +00:00
bors[bot]
ffa75e1e39
Merge #1173 #1174
1173: nRF examples crates names r=lulf a=davidedellagiustina

Fixed nRF examples crates' names: they had the same names and they were conflicting during compilation (Cargo warning).

1174: add missing copy of icmpv6 checksum r=lulf a=lulf

add proto-ipv6 feature to stm32h7 example to catch issues in CI

Co-authored-by: Davide Della Giustina <davide@dellagiustina.com>
Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
2023-01-24 09:26:21 +00:00
Ulf Lilleengen
2a0ea52878
add missing copy of icmpv6 checksum
add proto-ipv6 feature to stm32h7 example to catch issues in CI
2023-01-24 10:25:37 +01:00
bors[bot]
5ee8626d72
Merge #1172
1172: IPv6 has no checksum r=lulf a=davidedellagiustina

As title says. Fixes `embassy-net` not compiling when feature `proto-ipv6` is enabled.

Co-authored-by: Davide Della Giustina <davide@dellagiustina.com>
2023-01-24 08:56:01 +00:00
Davide Della Giustina
32bdc54ccb
Changed crates' names for nrf examples since they were conflicting 2023-01-24 08:27:53 +00:00
Davide Della Giustina
f38d54a6a6
IPv6 has no checksum 2023-01-24 08:15:22 +00:00
bors[bot]
4dadfb41ea
Merge #1171
1171: Implement From<gpio::Level> for bool r=Dirbaio a=hulthe

From implies Into, so this won't break anything.

Co-authored-by: Joakim Hulthe <joakim@hulthe.net>
2023-01-23 17:38:05 +00:00
Joakim Hulthe
64e610fef7
Replace Level: Into<bool> with From<Level>
This automatically implements Into<bool> for Level
2023-01-23 13:35:24 +01:00
bors[bot]
f98ba4ebac
Merge #1168
1168: Fix rcc prescaler for wb55 HCLK1 r=lulf a=chrenderle

- fix prescaler not divided which incorrectly set prescaler divided by 3
Issue: #1137 

Co-authored-by: Christian Enderle <mail@chrenderle.de>
2023-01-21 14:10:02 +00:00
Christian Enderle
5e3c33b777 Fix rcc prescaler for wb55 HCLK1
- fix prescaler not divided which incorrectly set prescaler divided by 3
2023-01-21 14:39:25 +01:00
Dario Nieuwenhuis
6ad2bcf97a
Merge pull request #1166 from embassy-rs/sdmmc-fix
fix embedded-sdmmc integration.
2023-01-21 01:22:17 +01:00
Dario Nieuwenhuis
0412d1922c fix embedded-sdmmc integration.
- Rename feature to `embedded-sdmmc`.
- Move embedded-sdmmc fork repo to the embassy-rs org.
- Remove unused features in the fork
- Fix impl in embassy-stm32
- Add to CI so it doesn't break again.
2023-01-21 00:32:34 +01:00
Dario Nieuwenhuis
825b67101b
Merge pull request #1164 from embassy-rs/stm32-print-rcc
stm32/rcc: print actual freqs on boot.
2023-01-20 17:08:20 +01:00
Dario Nieuwenhuis
f604153f05 stm32/rcc: print actual freqs on boot. 2023-01-20 16:31:04 +01:00
bors[bot]
539a8107e2
Merge #1161
1161: WIP: Smoltcp socket config r=Dirbaio a=Czocher

This PR updates the smoltcp version to the newest master one as well as implements the feature specified in #1154 - to allow the dhcpv4 socket to be configured.

Currently it should be considered a WIP PR - requires testing.

`@Dirbaio` can you have a look and check if this is compatible with what we discussed on the matrix channel?

Co-authored-by: Paweł Jan Czochański <pawel@czochanski.pl>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-01-19 13:57:21 +00:00
Dario Nieuwenhuis
78c2c1709b net: update smoltcp. 2023-01-19 14:44:01 +01:00
Dario Nieuwenhuis
fe15a7beee net: allocate space for 2 sockets, needed for dhcp. 2023-01-19 14:44:01 +01:00
Dario Nieuwenhuis
570ffab670 net: poll returning false is not an error. No need to repoll. 2023-01-19 14:44:01 +01:00
Paweł Jan Czochański
8f4fae9b36 Add smoltcp dhcp socket configuration 2023-01-19 14:44:01 +01:00
Paweł Jan Czochański
2eae12b7f1 Update smoltcp to the newest master 2023-01-19 14:44:01 +01:00
bors[bot]
65ab714fae
Merge #1162
1162: rp gpio: make pin_bank() inline r=Dirbaio a=mkj

This allows set_high() etc to be inlined, toggling pins should be much faster.

Co-authored-by: Matt Johnston <matt@ucc.asn.au>
2023-01-19 10:59:22 +00:00
Matt Johnston
83af513424 rp gpio: make pin_bank() inline
This allows set_high() etc to be inlined, toggling pins
should be much faster.
2023-01-19 13:36:40 +08:00
bors[bot]
f0ae1f9133
Merge #1159
1159: stm32 usb otg bug fixes r=Dirbaio a=chemicstry

This fixes a couple of usb otg bugs that surfaced with `usb_ethernet` example from nrf:
- Properly implemented `Endpoint::wait_enabled()`
- Return `EndpointError::Disabled` when neccessary in `Endpoint::write()`


Co-authored-by: chemicstry <chemicstry@gmail.com>
2023-01-18 11:30:44 +00:00
bors[bot]
db8e9efe73
Merge #1160
1160: Stop sampling when exiting the Saadc methods r=huntc a=huntc

Prior to this commit, the onDrop function was being dropped immediately and not on exiting the Saadc sampling methods.

A few other places have been corrected also.

Thanks to Peter Hansen for pointing out this issue.

Co-authored-by: huntc <huntchr@gmail.com>
2023-01-18 04:17:08 +00:00
huntc
6ab4ecaf83 Stop sampling when exiting the Saadc methods
Prior to this commit, the onDrop function was being dropped immediately and not on exiting the Saadc sampling methods.
2023-01-18 14:51:46 +11:00
chemicstry
b1203bf036 stm32/usb_otg: fix core formatter 2023-01-18 03:06:32 +02:00
chemicstry
7d34f4f538 stm32/usb_otg: Add F4 usb_ethernet example 2023-01-18 02:37:02 +02:00
chemicstry
f07e59b24a stm32/usb_otg: prevent writes on disabled endpoint 2023-01-18 02:31:28 +02:00
chemicstry
d2f2b451d0 stm32/usb_otg: implement endpoint wait_enabled 2023-01-18 02:29:49 +02:00
Dario Nieuwenhuis
15e3f42b7c
Merge pull request #1158 from embassy-rs/stm32c0
Add STM32C0 support.
2023-01-17 21:45:36 +01:00
Dario Nieuwenhuis
355761fd68 stm32: add stm32c0 examples. 2023-01-17 21:28:16 +01:00
Dario Nieuwenhuis
2a349afea7 stm32: add stm32c0 support. 2023-01-17 21:28:16 +01:00
bors[bot]
aea5a0fd96
Merge #1140
1140: feat(stm32): Let uart implement embedded-io Write trait r=Dirbaio a=rmja



Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-01-14 19:45:28 +00:00
bors[bot]
634704bff4
Merge #1153
1153: Documentation on verifying firmware r=lulf a=huntc

The documentation has been enhanced to describe the verification of firmware with the firmware updater. Examples have also been provided that describe how keys can be generated and how firmware can be signed.

Co-authored-by: huntc <huntchr@gmail.com>
2023-01-14 08:26:30 +00:00
huntc
868d01889b Documentation on verifying firmware
The documentation has been enhanced to describe the verification of firmware with the firmware updater. Examples have also been provided that describe how keys can be generated and how firmware can be signed.
2023-01-14 17:36:22 +11:00
Rasmus Melchior Jacobsen
16590732f8 Update mod.rs 2023-01-14 07:13:29 +01:00
Rasmus Melchior Jacobsen
816b214403 Only implement Write 2023-01-14 07:12:43 +01:00
bors[bot]
b6c8505697
Merge #1142
1142: More rp2040 BufferedUart fixes r=Dirbaio a=timokroeger

* Refactor init code
* Make it possible to drop RX without breaking TX (or vice versa)
* Correctly handle RX buffer full scenario

Co-authored-by: Timo Kröger <timokroeger93@gmail.com>
2023-01-14 00:07:02 +00:00
Matt Ickstadt
7ecb05ff77 usb: allow setting the interface string for interface alt settings 2023-01-13 12:10:36 -06:00
bors[bot]
b0c8c688c7
Merge #1147
1147: Support codesigning in the firmware updater r=lulf a=huntc

This PR provides a method to verify that firmware has been SHA-512 hashed and signed with a private key given its public key. The implementation provides both [`ed25519-dalek`](https://github.com/dalek-cryptography/ed25519-dalek/blob/main/Cargo.toml) and [`salty`](https://github.com/ycrypto/salty) as the signature verifiers. Either of the `ed25519-dalek` and `ed25519-salty` features is required to enable the functionality from `embassy-boot`.

The `verify_and_mark_updated` method is used in place of `mark_updated` when signing is used via its feature. This avoids the accidental omission of validation where it has been declared as required at compile time. It also keeps the parity of calls at the same number to the previous situation.

The PR permits other types of signature verifiers in the future on the proviso that the [Signature trait](https://github.com/RustCrypto/traits/tree/master/signature) is supported.

Finally, I've updated the CI to include testing `embassy-boot`, which it was doing before. In addition, I've included a unit test for verification based on a `ed25519-dalek` documentation example. This tests both the `dalek` and `salty` implementations.

In terms of code size comparisons, `dalek` adds about 68KiB and `salty` adds about 20KiB. I'm using `salty` myself. I've also tested this out by signing my code with the OpenBSD `signify` utility and then verify it during firmware upload using `salty`.


Co-authored-by: huntc <huntchr@gmail.com>
2023-01-12 20:43:24 +00:00
huntc
b0529bc943 Support codesigning in the firmware updater
This commit provides a method to verify that firmware has been signed with a private key given its public key. The implementation uses ed25519-dalek as the signature verifier. An "ed25519" feature is required to enable the functionality. When disabled (the default), calling the firmware updater's verify method will return a failure.
2023-01-12 13:30:58 +11:00
bors[bot]
88fd521b01
Merge #1145
1145: STM32 USB OTG #2 r=Dirbaio a=chemicstry

This is a continuation of #799

The usb serial example is already working!

TODO:
- [x] Add critical sections to registers shared with IRQ
- [x] Fix `disable()`
- [x] ~Implement cable disconnect detection~ - postponed
- [x] Fix `endpoint_set_enabled()`
- [x] ~Endpoint `wait_enabled`~ USB OTG does not have enable delay (?)
- [x] HS internal and HS ULPI PHY - untested

Co-authored-by: chemicstry <chemicstry@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-01-11 17:05:59 +00:00
chemicstry
1af102a1aa stm32 otg: add examples. 2023-01-11 17:58:15 +01:00
Dario Nieuwenhuis
041531c829 stm32/rcc: fix u5 pll, add hsi48. 2023-01-11 17:57:22 +01:00
chemicstry
0feecd5cde stm32: add USB OTG support.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-01-11 17:56:47 +01:00