Giter VIP home page Giter VIP logo

sc16is752's Issues

RTC with UART, bus busy

If I'm using RTC (PCF8523) which uses I2C also as UART(SC16IS752) I keep getting error (if using each component separately it works as it should):

10:14:26.202 -> [D][esp32-hal-i2c.c:1345] i2cProcQueue(): Gross Timeout Dead start=0x28cf0, end=0x28d22, =50, max=50 error=1
10:14:26.202 -> [E][esp32-hal-i2c.c:318] i2cDumpI2c(): i2c=0x3ffbec1c
10:14:26.202 -> [I][esp32-hal-i2c.c:319] i2cDumpI2c(): dev=0x60027000 date=0x16042000
10:14:26.202 -> [I][esp32-hal-i2c.c:321] i2cDumpI2c(): lock=0x3ffb8568
10:14:26.202 -> [I][esp32-hal-i2c.c:323] i2cDumpI2c(): num=1
10:14:26.202 -> [I][esp32-hal-i2c.c:324] i2cDumpI2c(): mode=1
10:14:26.237 -> [I][esp32-hal-i2c.c:325] i2cDumpI2c(): stage=3
10:14:26.237 -> [I][esp32-hal-i2c.c:326] i2cDumpI2c(): error=1
10:14:26.237 -> [I][esp32-hal-i2c.c:327] i2cDumpI2c(): event=0x3ffb8600 bits=200
10:14:26.237 -> [I][esp32-hal-i2c.c:328] i2cDumpI2c(): intr_handle=0x3ffb8630
10:14:26.237 -> [I][esp32-hal-i2c.c:329] i2cDumpI2c(): dq=0x3ffb864c
10:14:26.237 -> [I][esp32-hal-i2c.c:330] i2cDumpI2c(): queueCount=2
10:14:26.237 -> [I][esp32-hal-i2c.c:331] i2cDumpI2c(): queuePos=1
10:14:26.237 -> [I][esp32-hal-i2c.c:332] i2cDumpI2c(): errorByteCnt=-1
10:14:26.274 -> [I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorQueue=1
10:14:26.274 -> [I][esp32-hal-i2c.c:334] i2cDumpI2c(): debugFlags=0x00000000
10:14:26.274 -> [I][esp32-hal-i2c.c:311] i2cDumpDqData(): Debug Buffer not Enabled
10:14:26.274 -> [I][esp32-hal-i2c.c:354] i2cDumpInts(): Debug Buffer not Enabled
10:14:26.274 -> [I][esp32-hal-i2c.c:1130] i2cProcQueue(): Bus busy, reinit

My code.
`
#include <SPI.h>
#include <Wire.h>
#include <SC16IS752.h>

#define GPIO 0
#define EXP_PIN 21
#include "RTClib.h"

RTC_PCF8523 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

SC16IS752 i2cuart = SC16IS752(SC16IS750_PROTOCOL_I2C, 0x48);

void setup()
{
Serial.begin(115200);
Serial.println("Start testing");

pinMode(EXP_PIN, OUTPUT);
digitalWrite(EXP_PIN, HIGH);

if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
rtc.start();

i2cuart.begin(SC16IS752_DEFAULT_SPEED, SC16IS752_DEFAULT_SPEED); //baudrate setting
if (i2cuart.ping() != 1) {
Serial.println("Device not found");
while (1);
} else {
Serial.println("Device found");
}

i2cuart.pinMode(GPIO, OUTPUT);
i2cuart.digitalWrite(GPIO, LOW);
}

void loop()
{
i2cuart.digitalWrite(GPIO, HIGH);
delay(1000);
i2cuart.digitalWrite(GPIO, LOW);
delay(1000);

DateTime now = rtc.now();
Serial.print(now.year(), DEC);

delay(5000);
}
`

I2c address 0x4D

Hello! I have the same module. The I2c scanner transmits the address 0x4D. And the example with 0x4D does not work. Do not know what the problem is?

question about this driver

is it possible to register this to the OS as /dev/tty-something device so it can be used with ready made apps ?

RS485 ESP32 half-duplex communication

Hi, I have a question, so I have two identical devices that I would like to communicate via RX / TX (RS485). Both devices are exactly the same component, but as far as I know this is half-duplex mode, which means the first device sends, the second device receives and then again the second device receives and the first device sends. I have no idea how to write code for this communication. I found here as far as this chip is concerned GitHub - nopnop2002/SC16IS752: Driver for SC16IS752 also tried to load on both devices example code SC16IS752/Arduino & ESP8266/example/I2C_RECEIVE at master · nopnop2002/SC16IS752 · GitHub but nothing works. Some ideas?

Using interrupts on digital pins

Hi,
Can someone explain me how to use interrupts in this expander? I would like to detect changes on digital pins. Does the expander store pin number by which the interrupt was trigerred or do I need to read all the pins and define which pin trigerred the interrupt by myself in Arduino code?

Add LICENSE

I'd like to use this library but this repository does not include LICENSE.
Would it be possible to clarify the license terms?

Question on wiring

Hi,
My sensor is i2c and i want to convert it to rs485 so that it can connect with my controllers at 20 meter away. But I do not want to use any MCU to convert i2c to RS485.

So I want to connect my i2c sensor to this SC16IS752 and then to UART~RS485(MAX485) module and then to my controller. Does this work?

Thanks

no Default SDA Pin for Second Peripheral

Hello,

I'm using the arduino version (nonop2002/sc16s752) with arduino core esp 32 as component (esp-idf 4.4, arduino esp32 master)
The program compilation is OK, but at run time, when it arrives at :

i2cuart.begin(SC16IS752_DEFAULT_SPEED, SC16IS752_DEFAULT_SPEED);

Those errors appears and the esp32 reboot :

[ 56][E][Wire.cpp:77] initPins(): no Default SDA Pin for Second Peripheral
[ 57][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 59][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 65][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 72][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 78][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 85][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 91][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 98][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 105][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 111][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 117][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 123][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 129][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 136][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 143][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 149][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 155][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 161][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 167][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 174][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 180][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
[ 187][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 193][E][esp32-hal-i2c.c:142] i2cWrite(): could not acquire lock
[ 199][E][esp32-hal-i2c.c:225] i2cWriteReadNonStop(): could not acquire lock
E (734) Main: I2C_serial not found

Any idea if it's coming from me or from the library ?

Thanks, Ed.

How to specifying SCL and SDA.

  • arduino core for esp32:
    Wire.setPins(int sdaPin, int sclPin);
    i2cuart.begin(baudrate_A, baudrate_B);

  • arduino core for esp8266:
    Can not.

  • atmega:
    #define SDA_PORT PORTD
    #define SDA_PIN SDA
    #define SCL_PORT PORTD
    #define SCL_PIN SCL
    #include <SoftI2CMaster.h>
    #include <SoftWire.h>
    SoftWire Wire = SoftWire();
    i2cuart.begin(baudrate_A, baudrate_B);

  • Arduino core support for STM32 based boards:
    Wire.setSCL(SCL);
    Wire.setSDA(SDA);
    i2cuart.begin(baudrate_A, baudrate_B);

  • Arduino Core for Nordic Semiconductor nRF5 based boards:
    Wire.setPins(int sdaPin, int sclPin);
    i2cuart.begin(baudrate_A, baudrate_B);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.