API changes and new stuff coming

Kakapo API updates first. The SPI API was changed yet again to include providing the byte to send when stuffing the TX side with irrelevant data. The “txdummy” param to spi_conf() configures what the byte should be when stuffing.

This is mostly useful for dealing with SD cards over SPI, as to push them into SPI mode you need to issue >=74 SCK cycles with its data-in pin high. Stuffing the output with 0xff does the trick for this.

Since I’ve mentioned SD cards, the Net+SD shield is nearly complete and should see the first prototype ordered next week. This includes a WizNet W5500 TCP/IP chip and a microSD card socket.

The shield is roughly similar to the official Arduino Ethernet shields (using the same pins as that shield), but includes a MAC EEPROM on I2C and all used pins can be disabled with simple jumpers. This means you can use just the Ethernet or SD functions of the board. It also includes pull-up resistors on the I2C port, with a jumper to disable them if you already have pull-ups somewhere else.

To ensure the W5500 reset is consistent with the main Kakapo board, there is a buffered reset handler. The output pins of both the SD card and the W5500 are also buffered and controlled by the CS pin for each function to ensure no disturbance of header pins they are connected to.

The W5500 is an upgraded version of the W5100 featured on Arduino official shields. It includes 32k SRAM (up from 16), 8 sockets (up from 4), and allows variable length transfers (instead of fixed 1, 2 or 4 byte transfers). The latter means we can push larger blocks of data into or pull out of sockets with less overhead.

Since I know people will want to hit the ground running, a basic driver for the W5500 for TCP client and UDP in both directions has been pushed into libkakapo. There is a stub which still needs to be completed for TCP server support. The TCP code supports using standard IO functions with TCP connections, like the USART driver.

At this point, I’m still working on the SD card support, and it’s likely the board will be released before this support is completed in libkakapo. The W5500 driver also still uses fixed IP configuration, a DHCP client and other high-level protocols (like DNS) are still to come.

Leave a Reply