esp-hosted-fg SPI can't use pin 33 as HS or DR
functions set_handshake_gpio, reset_handshake_gpio, set_dataready_gpio and reset_dataready_gpio use WRITE_PERI_REG which treats mask as a 32 bit value.
I want to make esp-hosted-fg work on Arduino Nano RP2040 Connect where the io available for DR and HS are io 0 and io 33.
WRITE_PERI_REG are all slave side part. Don't you use the slave and slave software as is?
You can always change the host, as per your need.
I am still trying to understand the problem, if you could detail a bit.
spi_slave_api_.c
the io 33 mask for WRITE_PERI_REG is 1 << 33 which doesn't fit into 32 bits, but WRITE_PERI_REG casts it to 32 bit.
I think correct is
static inline void set_handshake_gpio(void)
{
gpio_set_level(GPIO_HS, 1);
}
static inline void reset_handshake_gpio(void)
{
gpio_set_level(GPIO_HS, 0);
}
static inline void set_dataready_gpio(void)
{
gpio_set_level(GPIO_DR, 1);
}
static inline void reset_dataready_gpio(void)
{
gpio_set_level(GPIO_DR, 0);
}
https://content.arduino.cc/assets/ABX00053-schematics.pdf
Yes. You are correct.
Either use above changes, or use
1ULL << 33
just 1ll is not enough
#define WRITE_PERI_REG(addr, val) do { \
ASSERT_IF_DPORT_REG((addr), WRITE_PERI_REG); \
(*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val); \
} while(0)
there is (uint32_t)(val);
@JAndrassy ,
Yes, you are absolutely correct. We will correct the master with this change.
I see now, there is already a PR https://github.com/espressif/esp-hosted/pull/248/ from last year