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.
9 years, 4 months ago.
Adapt to 16IS752 Dual-UART
Hi,
I have built an I2C dual UART board for the Seeed Xadow system. It has been successfully tested with the Arduino form factor of the board. Can this library be adapted to function with this version of the chip.
Cheers,
whatnick.
Question relating to:
1 Answer
9 years, 4 months ago.
Yes, this should be possible. The 16IS750 and 16IS752 are very similar. The 752 has 2 UART channels (A and B) that are basically the same as the single channel provided in the 750. The selection is made by using different register addresses. I had made some provisions in the library for such a later extension. The plan is to add new subclasses for the SC16IS752 with a parameter to select either one of the channels:
class SC16IS752_I2C : public SC16IS750 { /** Create an SC16IS752_I2C object using a specified I2C bus, slaveaddress and Channel * * @param I2C &i2c the I2C port to connect to * @param char deviceAddress the address of the SC16IS750 * @param rst Pinname for Reset pin (active low) Optional, Default = NC * @param channel UART ChannelName, Default = Channel_A */ SC16IS752_I2C(I2C *i2c, uint8_t deviceAddress = SC16IS750_DEFAULT_ADDR, PinName rst = NC, ChannelName channel = SC16IS750::Channel_A); } class SC16IS752_SPI : public SC16IS750 { /** Create an SC16IS752_SPI object using a specified SPI bus and CS * * @param SPI &spi the SPI port to connect to * @param cs Pinname of the CS pin (active low) * @param rst Pinname for Reset pin (active low) Optional, Default = NC * @param channel UART ChannelName, Default = Channel_A */ SC16IS752_SPI(SPI *spi, PinName cs, PinName rst = NC, ChannelName channel = SC16IS750::Channel_A ); }
Would that work for you? (Too late, it's done...)
There may be some issues to solve when using interrupts rather than polling to handle TX and RX buffers.
The original lib (v01) should already work for the A channel on the SC16IS752. Have you tried that out?
I am unable to get either a 750 or a 752 based board to work over i2c. I have tested both boards successfully with an Arduino over i2c (using the same code) so your comment about them being very similar is correct. There must be some bugs in the i2c version of the library.
posted by 22 Dec 2014I will have a look at the I2C version of the lib. Just about all my testing was done with SPI. Have you verified that the I2C bus on your hardware is OK : wiring ok, pull-up OK, is the 752 slaveaddress set correctly (default 0x90, so A0, A1 are at VCC and NOT at GND as you might expect!). Has the I2C bus been tested with any other devices?
edit: OK, I checked the lib for the I2C mode. The I2C clockspeed turned out to be critical on my test breadboard. The default clocksetting in the lib was 400kb/s. That did not work and had be reduced to about 100kb/s. This is now the default setting in the lib. The max reliable setting will depend on your hardware and wiring (busload etc). You may have to do some testing. The lib seems to work fine otherwise.
posted by 23 Dec 2014I have published my Xadow adaptations here: http://developer.mbed.org/users/whatnick/code/Xadow_SC16IS750_Test/ . On Arduino I have this library -https://github.com/StrichLabs/MultiSerial/ working successfully with both devices. My device address is 0x4D as revealed by Arduino i2c scanner.
PS: Using 0x9A as the address solved my issues. Thanks for the tip. Working on both versions of the board now. Thanks for a nice Christmas gift, have a great 2015. Let me know if I can be of assistance in anyway.
posted by 24 Dec 2014