Finally have working SPI! RST pin isn't being pulled high well enough so the AT86RF was in reset this whole time, along with the wiring issue

This commit is contained in:
Kelvin Ly 2022-04-17 22:21:31 -04:00
parent cc053c9d76
commit 6e82927d47
2 changed files with 6 additions and 1 deletions

View File

@ -2,14 +2,18 @@
#include "pico/stdlib.h"
#define TEST_GPIO 8
#define TEST_GPIO2 5
int main() {
stdio_init_all();
gpio_init(TEST_GPIO);
gpio_init(TEST_GPIO2);
gpio_set_dir(TEST_GPIO, GPIO_OUT);
gpio_set_dir(TEST_GPIO2, GPIO_OUT);
bool val = true;
while (true) {
gpio_put(TEST_GPIO, val);
gpio_put(TEST_GPIO2, val);
val = !val;
sleep_ms(25);
}

View File

@ -38,7 +38,7 @@ static void spi_register_read(uint16_t address, uint8_t *buf, uint16_t len) {
cmd[0] &= ~(3 << 6); // mask out top two bits
cs_select();
spi_write_blocking(SPI, cmd, 2);
spi_read_blocking(SPI, 0, buf, len);
spi_read_blocking(SPI, 0x00, buf, len);
cs_deselect();
}
@ -54,6 +54,7 @@ int main() {
gpio_set_dir(PICO_DEFAULT_SPI_CSN_PIN, GPIO_OUT);
gpio_put(PICO_DEFAULT_SPI_CSN_PIN, 1);
gpio_init(AT86_RSTN);
gpio_set_dir(AT86_RSTN, GPIO_OUT);
gpio_put(AT86_RSTN, 1);