I am trying to use the !CS pin for this purpose. I have worked out how to detect when a connection is made and released using the CDC_SET_CONTROL_LINE_STATE case in CDC_Control_FS. I can toggle the status led when a connection is opened and closed on the host (e.g. by cat /dev/ttyACM0), but I am having difficulty setting up the !CS pin. At the moment, I have (in main.cpp):
/*Configure GPIO pin : !CS PIN (red led) */
GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
The !CS pin is ice40 pin 56 and corresponds to the red led so I expect to be able toggle it, like I did the status led, but it does not toggle.
The STM32F30 data sheet says PA15 is used for JTDI, so do I need to use an alternate function?
As the pin is the red led and is used by a lot of the ice40 examples will there be a conflict? Should I have it as OUTPUT_PP or OUTPUT_OD? Any idea why it is not working?