5 years, 3 months ago.

Anyyone used a USB port and 2 buses on lpc11u24 or similar (N/A to mbed with "magic chip") ?

Unable to run with BusIn, BusOut and USB - LPC11u24 mbed variant (N.B works OK on mbed with magic chip!) Anyone done this?

Able to read a bus(BAddress) and output to USB port, but writing this to another bus (BData) program crashes. If USB commented out then data reads fine and writes to second port correctly. Pls see code below.

  1. include "mbed.h"
  2. include "USBSerial.h" No magic chip

USBSerial pc; No magic chip

Serial pc(USBTX, USBRX); tx, rx mbed else comment this out and comment in two above

DigitalOut AS = (P1_15),RW =(P0_21),Motorspeed=(P0_7);

char RXD[32]; int StrSize = 0;

void RdWrAddr (int iAddr, bool bWr);1 write int iAddrIn=0; int USBdata=0; int AddrVal=0; bool USBWrite = false; use to control USB flow true == write

BusIn *BAddress; BusOut *BData;

int main() { BData = new BusOut (P0_9,P0_8,P1_29,P0_2,P1_22,P1_21,P1_20,P0_10); BAddress = new BusIn (P0_18,P0_5,P0_4,P1_25,P1_24,P1_14,P0_1,P0_17);

Motorspeed =1; Orange LED wait_ms(300);

while(1) { RdWrAddr(0,0); 0 READ ADDRESS BUS and tx USB RW =1;wait_ms(20); RW= 0;wait_ms(20); RW =1;wait_ms(20); RW= 0;wait_ms(20); Flash green running! wait_ms(1); Min Sample Rate 1uS? for Read + loop time tbd? Motorspeed=0; wait_ms(100); } }

void RdWrAddr(int iAddr,bool bWr) write =1 { if(bWr == 1)write { AS =1; wait_us(10); return;


else read { AS =0; AddrVal = BAddress->read(); Read Addr Bus

if (AddrVal != USBdata) Do when Addr changes { USBdata = AddrVal; Prepare USB data (ie going to send the Addr red above) BData->write(AddrVal); Write Addr to Data bus (LEDs) pc.putc(USBdata); TX ascii character wait_ms(1); Motorspeed=1;


else { pc.putc(95); send underscore on no data - USB Active

return; } return; } } Anyone seen this problem?

Be the first to answer this question.