Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
黄色いmbed LPC11U24を使っています。 使い方が今ひとつわかってないので恐縮ですが、 USBSerialで、USB側の通信(Downstream)を待たせることはできないのでしょうか。
USB -> SPIの変換をしています。
少しづつデータを送る分には何の問題もないのですが、大量のデータ(数KB)を一度に送ると、SPI側がBusyになりデータを落としてしまいます。 SPIがbusyの時、USB側もBusyにする方法がわかりません。
例えば、USB-UART変換などでは、Bufferからデータを取り出さない限り(UARTがbusy)、USBチップがNAK応答するんじゃないかと思うのですが、、、 使い方が良くないのでしょうか。
ソースは抜粋しています。。
USBSerial serial; SPI spi(p5, p6, p7); // mosi, miso, sclk DigitalIn RtsSoft( p10 ); int main(void) { int i = 0; uint8_t buf[128]; uint8_t datanum,buff; spi.format(8,3); // 8bit ,mode=3 spi.frequency(1250000); // 1.25MHz while(1) { datanum = serial.available(); for(i=0;i<datanum;i++){ while( RtsSoft == 1 ) ; // spi.write( serial._getc() ); } } }