Using MATLAB, how to change baud rate of data reception from i2c device via arduino?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I want to increase the speed of data acquisition from a i2c device connected to matlab (MATLAB 2017a) using arduino. The i2c device data updates maximum at a rate of 1kHz. I need at least 100 data per second from device but data transmission via arduino is too slow. Taking ~60ms for one data read from register of i2c device.
Is there any way to increase the baud rate of data transmission through arduino OR how to change baud rate with matlab?
Or any other suggestion to increase the data transmission speed? Thank you..
0 comentarios
Respuestas (1)
Asif Iqbal
el 20 de Oct. de 2017
Hi, So here is just some suggestion. Since in the I2C the clock speed is generated by the Master check the master clock speed. Based on what u wrote it seems like your Arduino board is the master. In that case increase the clock speed of the Arduino. While setting clock speed keep an eye out for "prescaler" related to I2C(There are prescaler for other modules too). what it does is reduces the clock speed u set for your I2C driver. So read the datasheet carefully and set the clock speed. Since the max speed is 1KHz you can set some value close to it. One more thing which might slow your data exchange speed is how much data you exchange during each message. Try to reduce that if possible.
3 comentarios
Francesco campagna
el 11 de Nov. de 2017
Mee too I had the same problem, since I'm using the library with 'arduino' function for i2C communication, there is no option to increase the Baudrate in this way. Can't find a solution nowhere
Jose Marcelo Duarte
el 25 de Mayo de 2020
Same problem here. I ended up giving up of MATLAB Arduino Support and created my own solution to use Arduino as an I2C/USB-Serial bridge to MatLab. Besides not having a simple solution to change serial port's baund rate, I have founded another problem in MATLAB Arduino Support. I was getting error in a loop of my code where there are an I2C write and an read operations. The MATLAB Arduino Support was silently ignoring some write operation. The problem disaper when I added a long time delay after each I2C operation. My target I2C slave device some times produces a long clock stretching (up to 5 ms). Maybe, the MATLAB Arduino Support does not support clock stretching, and so it is not full compilent with I2C spec.
Ver también
Categorías
Más información sobre Arduino Hardware en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!