Need help for use I2C Slave mode #1711
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#1711
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello,
I try to create a Hitec telemetry simulator and i need to define my I2C1 port as slave on the address 0x08.
I use this code:
`#include "hardware/i2c.h"
#include "hardware/irq.h"
#include "hardware/gpio.h"
uint8_t address = 0x08;
#define I2C_INTR_MASK_RD_REQ 0x00000020
void setup() {
Serial.begin(9600);
while (!Serial)
;
i2c_init(i2c1, 100000L);
i2c_set_slave_mode(i2c1, true, address);
gpio_set_function(2, GPIO_FUNC_I2C);
gpio_set_function(3, GPIO_FUNC_I2C);
gpio_pull_up(2);
gpio_pull_up(3);
i2c1->hw->intr_mask = I2C_INTR_MASK_RD_REQ;
irq_set_exclusive_handler(I2C1_IRQ, handler);
irq_set_enabled(I2C1_IRQ, true);
}
void loop() {
}
void handler() {
i2c1->hw->clr_rd_req;
Serial.print("\nRequest from address: 0x");
Serial.println(address);
uint8_t packet[7] = {0x18, 0x17, 0x0, 0x0, 0x0, 0x0, 0x18};
//i2c_write_raw_blocking(i2c1, packet, 7);
for (uint8_t i = 0; i < 7; i++) {
i2c_write_byte_raw(i2c1, packet[i]);
Serial.print(packet[i], HEX);
Serial.print(" ");
}
}`
But if i use my logique analyser on the pins 2 et 3 i receive nothing.
Can you help me to find my error please ?
Thanks,
Pierre
Your usage of
setup()adloop()makes it look like you're using one of the Arduino environments? That's not something that we support ourselves. Can you update your example to just use "pure"pico-sdkcode please?Also have you looked at https://github.com/raspberrypi/pico-examples/tree/master/i2c/slave_mem_i2c ?
hitec.zip
This is my code for my tests.
I wait this result with my analyser but the analyser don't see my frames from 0x11 to 0x1B.
Hitec_Orig.txt