Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: MSP432 I2C Multibytes Receive using Driverlib

$
0
0
Hi David, so i manage to get it to work but it is not doing what i expected. The I2C Master only reads 16bit values like before even if i say read 16bytes: /* Setup the number of bytes to receive */ i2cConfigADPD.byteCounterThreshold = ui8ByteCount;------->>>(16bytes) i2cConfigADPD.autoSTOPGeneration = EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD; Here is my code: /* Todo: Put a delay */ /* Wait until ready */ while (MAP_I2C_isBusBusy(EUSCI_B3_BASE)); /* Assign Data to local Pointer */ /* Disable I2C module to make changes */ MAP_I2C_disableModule(EUSCI_B3_BASE); /* Setup the number of bytes to receive */ i2cConfigADPD.byteCounterThreshold = ui8ByteCount; i2cConfigADPD.autoSTOPGeneration = EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD; MAP_I2C_initMaster(EUSCI_B3_BASE, (const eUSCI_I2C_MasterConfig *)&i2cConfigADPD); /* Load device slave address */ MAP_I2C_setSlaveAddress(EUSCI_B3_BASE, ui8Addr); /* Enable I2C Module to start operations */ MAP_I2C_enableModule(EUSCI_B3_BASE); /* Enable master STOP and NACK interrupts */ MAP_I2C_enableInterrupt(EUSCI_B3_BASE, EUSCI_B_I2C_STOP_INTERRUPT + EUSCI_B_I2C_NAK_INTERRUPT); /* Set our local state to Busy */ ui8Status = eUSCI_BUSY; /* Send start bit and register */ MAP_I2C_masterSendMultiByteStart(EUSCI_B3_BASE,ui8Reg); /* Enable master interrupt for the remaining data */ while(!(I2C_getInterruptStatus(EUSCI_B3_BASE, EUSCI_B_I2C_TRANSMIT_INTERRUPT0))); ui8Status = eUSCI_BUSY; /* Turn off TX and generate RE-Start */ MAP_I2C_masterReceiveStart(EUSCI_B3_BASE); while(!(I2C_getInterruptStatus(EUSCI_B3_BASE, EUSCI_B_I2C_RECEIVE_INTERRUPT0))); if(ui8Status == eUSCI_NACK) { return(false); } else { return(true); }

Viewing all articles
Browse latest Browse all 62309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>