So I'm currently using an SAME 54 Xplained Pro to develop a proof of concept for communication with two I/O Expanders. I'm trying to communicate with the two expanders over parallel SPI so that they share a MOSI, MISO, and SCK, but have different, software controlled CS lines. I'm using spi_m_sync_transfer() because I wasn't able to get io_read/write() to work.
Anyway, my problem is that no matter what I try to do, I can't separate the chip select lines. No matter what I change, anytime I do an SPI transfer to an individual expander, both CS lines go low, causing it to write to both.
I originally started by manually setting the gpio line to low when I was transferring and moving it back to high, but later I realized that even without my software toggling, the driver/hardware/something automatically toggles it. This isn't a problem for a single slave, but with parallel slaves, I need to be able to separately write to each expander. The SPI driver has a CTRLB.MSSEN register that controls hardware controlled chip selects. However, this defaults to 0, allowing the user to control the CS lines. Another potential solution could be the gpio_set_pin_function, which I've tried using both GPIO_PIN_FUNCTION_OFF and GPIO_PIN_FUNCTION_B (from reading someone's post that suggested it), but I haven't been able to find any documentation on what each of the different pin functions are for. I've also tried moving around which pins I'm using on the CS line onto different GPIO's/CS/extension headers, but that shouldn't matter and it didn't help.
I've heard about and experienced myself a lot of issues with ASF4's SPI Driver, so it could easily be that. Although I'm thinking it's something with the SAME54XPro, but I've yet to figure out what that could be.
Any suggestions would be greatly appreciated.