sufyank123 0 Posted August 23, 2019 Share Posted August 23, 2019 I am using MSP432P401R and wanted to increase the I2C frequency from 100kHz(Standard) to 400kHz(Fast). In the Wire library for arduino, there is a function Wire.setclock(). Has anybody written such a function for energia? Because it is not there in energia. I went through the wire and twi libraries and found the following, In wire library, Wire.endTransmission calls a fucntion in twi library, twi_writeTo() which has the following line of code, UCBzCTL1 |= UCSSEL_2; // SMCLK Is this the line of code that sets the clock speed? Also in the twi.h library, the line of code, #define TWI_FREQ 100000L defines the frequency as 100kHz, but even if I changed it to 400000L, I don't see any change on hardware. Is this the right way? I'd appreciate if anyone can help me with this. Thanks Quote Link to post Share on other sites
enl 227 Posted August 23, 2019 Share Posted August 23, 2019 UCSSEL_2 is the selector bit set for the sub-main clock as the clock source for the UCB serial module. I have not looked through the code (and do not use the MSP432 processors) so I I can't give details, and someone else may be able to give you a full answer, but if you see assignments to UCBxBR0 and UCBxBR1, these are setting the baud rate register divider (the BR in the names is for "BAUD RATE"). If no one comes in with more complete information in the next day or two, I can look at the source. Quote Link to post Share on other sites
sufyank123 0 Posted August 24, 2019 Author Share Posted August 24, 2019 Thank you for the response and the initiative. I will be waiting for a response and will also report if I find anything on this in the meantime. Quote Link to post Share on other sites
sufyank123 0 Posted August 28, 2019 Author Share Posted August 28, 2019 On 8/24/2019 at 12:15 AM, enl said: UCSSEL_2 is the selector bit set for the sub-main clock as the clock source for the UCB serial module. I have not looked through the code (and do not use the MSP432 processors) so I I can't give details, and someone else may be able to give you a full answer, but if you see assignments to UCBxBR0 and UCBxBR1, these are setting the baud rate register divider (the BR in the names is for "BAUD RATE"). If no one comes in with more complete information in the next day or two, I can look at the source. Can you help me out, I'm stuck because of this problem. Quote Link to post Share on other sites
Rei Vilo 695 Posted August 28, 2019 Share Posted August 28, 2019 Please refer to Wire.cpp#L121-L123 I2C_Params_init(¶ms); params.transferMode = I2C_MODE_BLOCKING; params.bitRate = I2C_400kHz; enl 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.