-
Notifications
You must be signed in to change notification settings - Fork 163
pi pico net examples #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pi pico net examples #832
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
Found 60 issues on changed lines in 16 files:
- examples/microchip/atsam/src/blinky.zig: 1 issue
- examples/nordic/nrf5x/build.zig: 1 issue
- port/stmicro/stm32/src/hals/STM32F103/DMA.zig: 5 issues
- port/stmicro/stm32/src/hals/STM32F103/adc.zig: 1 issue
- port/stmicro/stm32/src/hals/STM32F103/i2c.zig: 1 issue
- port/stmicro/stm32/src/hals/STM32F103/rcc.zig: 1 issue
- port/stmicro/stm32/src/hals/common/i2c_v2.zig: 1 issue
- port/stmicro/stm32/src/hals/common/util.zig: 1 issue
- tools/linter/src/main.zig: 1 issue
- tools/regz/src/Database.zig: 3 issues
- tools/regz/src/atdf.zig: 18 issues
- tools/regz/src/embassy.zig: 2 issues
- tools/regz/src/gen.zig: 7 issues
- tools/regz/src/output_tests.zig: 1 issue
- tools/regz/src/svd.zig: 15 issues
- tools/regz/src/xml.zig: 1 issue
ℹ️ Additional issues on unchanged lines
The following 63 issue(s) exist but are not on lines changed in this PR:
build-internals/build.zig:121: Suggestion: Rename `Cpu` to `CPU`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
build.zig:325: TODO style comments need to have a linked microzig issue on the same line.
build.zig:8: Suggestion: Rename `Cpu` to `CPU`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
core/src/cpus/cortex_m.zig:850: Suggestion: Rename `IrqHandlerFn` to `IRQ_HandlerFn`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
core/src/cpus/cortex_m.zig:879: Suggestion: Rename `HardFault_name` to `HardFaultName`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
core/src/cpus/cortex_m.zig:880: Suggestion: Rename `BusFault_name` to `BusFaultName`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
core/src/cpus/cortex_m.zig:881: Suggestion: Rename `MemManageFault_name` to `MemManageFaultName`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
core/src/cpus/cortex_m.zig:882: Suggestion: Rename `UsageFault_name` to `UsageFaultName`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/build.zig:25: TODO style comments need to have a linked microzig issue on the same line.
examples/raspberrypi/rp2xxx/src/net/lwip/net.zig:534: Suggestion: Rename `IPFormatter` to `IP_Formatter`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/build.zig:18: TODO style comments need to have a linked microzig issue on the same line.
examples/stmicro/stm32/src/stm32f1xx/adc_dualmode.zig:11: Suggestion: Rename `AdvancedADC` to `Advanced_ADC`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/adc_dualmode.zig:18: Suggestion: Rename `ADC_pin1` to `ADC_Pin1`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/adc_dualmode.zig:19: Suggestion: Rename `ADC_pin2` to `ADC_Pin2`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/adc_dualmode.zig:25: Suggestion: Rename `AdcData` to `ADC_Data`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/advanced_adc.zig:19: Suggestion: Rename `AdvancedADC` to `Advanced_ADC`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/advanced_adc.zig:27: Suggestion: Rename `ADC_pin1` to `ADC_Pin1`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/advanced_adc.zig:28: Suggestion: Rename `ADC_pin2` to `ADC_Pin2`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/stmicro/stm32/src/stm32f1xx/advanced_adc.zig:29: Suggestion: Rename `ADC_pin3` to `ADC_Pin3`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/raspberrypi/rp2xxx/src/hal/dma.zig:120: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/boards/STM32L476DISCOVERY.zig:27: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/boards/STM32L476DISCOVERY.zig:8: Suggestion: Rename `LcdRam` to `LCD_RAM`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/boards/STM32L476DISCOVERY.zig:20: Suggestion: Rename `Lcd` to `LCD`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/generate.zig:256: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/STM32F103.zig:24: Suggestion: Rename `Reset_Reason` to `ResetReason`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/STM32F103/adc.zig:374: Suggestion: Rename `AdvancedADC` to `Advanced_ADC`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/STM32F103/rcc.zig:2: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/STM32F103/rcc.zig:309: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/STM32F103/spi.zig:28: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/STM32F103/uart.zig:1: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/STM32F103/uart.zig:2: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/STM32F303/rcc.zig:25: Suggestion: Rename `RccErrorConfig` to `RCC_ErrorConfig`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/i2c_v2.zig:69: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/i2c_v2.zig:80: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/i2c_v2.zig:113: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/i2c_v2.zig:13: Suggestion: Rename `I2CError` to `I2C_Error`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/i2c_v2.zig:21: Suggestion: Rename `TimingSpec_Standard` to `TimingSpecStandard`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/pins_v2.zig:46: Suggestion: Rename `InputGPIO` to `Input_GPIO`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/pins_v2.zig:57: Suggestion: Rename `OutputGPIO` to `Output_GPIO`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/timer_v1.zig:169: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/timer_v1.zig:172: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/timer_v1.zig:24: Suggestion: Rename `ARRModes` to `ARR_Modes`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/timer_v1.zig:112: Suggestion: Rename `CCConfig` to `CC_Config`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/timer_v1.zig:173: Suggestion: Rename `GPTimer` to `GP_Timer`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/timer_v1.zig:542: Suggestion: Rename `PWMChConfig` to `PWM_ChConfig`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/stmicro/stm32/src/hals/common/uart_v3.zig:77: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/uart_v3.zig:79: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/uart_v3.zig:82: TODO style comments need to have a linked microzig issue on the same line.
port/stmicro/stm32/src/hals/common/uart_v3.zig:192: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/clocks.zig:14: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/clocks.zig:150: TODO style comments need to have a linked microzig issue on the same line.
port/wch/ch32v/src/hals/clocks.zig:173: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:703: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:730: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:733: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:752: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:779: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:782: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/atdf.zig:792: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/embassy.zig:436: TODO style comments need to have a linked microzig issue on the same line.
tools/regz/src/embassy.zig:87: Suggestion: Rename `Rcc` to `RCC`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
tools/regz/src/embassy.zig:558: Suggestion: Rename `Item_t` to `Item`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
tools/regz/src/gen.zig:421: TODO style comments need to have a linked microzig issue on the same line.
Updating with new lint results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 1 issue(s) exist but are not on lines changed in this PR:
examples/raspberrypi/rp2xxx/src/net/lwip/net.zig:534: Suggestion: Rename `IPFormatter` to `IP_Formatter`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
Grazfather
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good. Have to review more closely. Fixed up wording and some typoes.
Grazfather
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Noticed a few more typos/style issues. I'll ask for someone to test.
|
I've tested on my pico 2w and there are a couple of things not working. But anyhow, great work. A tcp server on a pico in zig is very nice. ReleaseSmall crashes with unhandled exception right away for both TCP server and client and maybe also udp TCP server works perfectly TCP Server Release Fast displays something sus TCP client (I have a listening netcat server on my computer but it might be an error on my end) Udp (EDIT: I realized now that this is because I haven't changed join options for my network that doesn't have any security). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 1 issue(s) exist but are not on lines changed in this PR:
examples/raspberrypi/rp2xxx/src/net/lwip/net.zig:565: Suggestion: Rename `IPFormatter` to `IP_Formatter`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
|
Thanks @tact1m4n3. For the tcp_client. Did you enter your host IP address in secrets.zig // IP address of the desktop host computer.
// Some examples will send to that host.
pub const host_ip = "192.168.190.235";For udp. That is wifi join fail error. Join sequence is the same as in tcp examples so I expect it to be transient. Do you get it on each retry (restart)? Unexpected data in tcp server is not the problem. WiFi chip got data packet while still joining network. I should probably just ignore it. |
I did. I am a bit concerned with the crash I got whenever I build in release small. Do you get it as well? EDIT: I tested udp again after fixing the join configuration and I can send packets to the pico, but I don't receive the echoed packets (on a separate nc instance). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 4 issue(s) exist but are not on lines changed in this PR:
drivers/wireless/cyw43439/ioctl.zig:29: Suggestion: Rename `SdpHeader` to `SDP_Header`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/wireless/cyw43439/ioctl.zig:74: Suggestion: Rename `CdcHeader` to `CDC_Header`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/wireless/cyw43439/ioctl.zig:401: Suggestion: Rename `BssInfo` to `BSS_Info`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/raspberrypi/rp2xxx/src/net/lwip/net.zig:565: Suggestion: Rename `IPFormatter` to `IP_Formatter`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
|
Thank you for your time. I was also getting crashes in ReleaseSmall/ReleaseSafe. I located that in a @bitcast line. As I understand there is 32 bit alignment requirement for some instructions. It was hit by unaligned data. Solved that by changing to @memcpy. udp, and tcp_client works for me. As I understand any incoming traffic to your host from the pico don't work. Is there chance that you have some kind of firewall blocking it. For the udp, when I send to the pico ip from the host: echo "message to the pico" | ncat -u 192.168.190.50 9999i got it echoed when listening on the host: or I also see valid udp packets in the Wireshark. |
|
Everything works now! It was a problem with my linux desktop when I didn't receive any incoming packets. It worked on another machine. |
Add tcp namespace; we will have Client and Server. Move root to the Interface so we can have net in the imports instead of Net.
When reciving clean close should call tcp_close and set connection state to closed.
It is enough to pass it into init.
with multiple calls of tcp_connect for the same Connection. Prevent that with setting state to .connecting and aborting pcb in on_connect (although that can't be reaced now).
Co-authored-by: Grazfather <grazfather@gmail.com>
Co-authored-by: Grazfather <grazfather@gmail.com>
They are now in the readme.
Co-authored-by: Grazfather <grazfather@gmail.com>
There are cases when data packet event is received while still not all join events are raised. This was logged as error but it is just misleading we can't do nothing about that until application starts listening for data packets.
Now all arguments are in the single file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 5 issue(s) exist but are not on lines changed in this PR:
drivers/wireless/cyw43439/ioctl.zig:29: Suggestion: Rename `SdpHeader` to `SDP_Header`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/wireless/cyw43439/ioctl.zig:74: Suggestion: Rename `CdcHeader` to `CDC_Header`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/wireless/cyw43439/ioctl.zig:401: Suggestion: Rename `BssInfo` to `BSS_Info`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
drivers/wireless/cyw43439/wifi.zig:103: Suggestion: Rename `ClmLoadControl` to `CLM_LoadControl`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/raspberrypi/rp2xxx/src/net/lwip/net.zig:565: Suggestion: Rename `IPFormatter` to `IP_Formatter`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
|
Thanks again @ianic, this is freaking awesome |
This if follow up of #789 adding more examples of how to use lwip with pi pico 2w.
There are udp send/receive and tcp client/server examples here. Readme should help with running examples.