Giter VIP home page Giter VIP logo

Comments (7)

nopnop2002 avatar nopnop2002 commented on June 29, 2024

Is your environment Arduino??
Is Rpi??

And please show me your code.

from sc16is752.

ArduinoGo avatar ArduinoGo commented on June 29, 2024

Sorry, forgot to specify the platform and IDE.

ESP 32 lolin32, Arduino IDE. I use the code from your example.

In the code library found device_address_sspin = (addr_sspin >> 1);

Removing the shift anyway at 0x4D does not work.

Log Code:
12: 27: 44.968 -> ReadRegister channel = 0 reg_addr = 70 result = FF
12: 27: 45.001 -> WriteRegister channel = 0 reg_addr = 70 val = FF
12: 27: 45.034 -> ReadRegister channel = 0 reg_addr = 10 result = FF
12: 27: 45.102 -> WriteRegister channel = 0 reg_addr = 10 val = FF
12: 27: 45.135 -> ReadRegister channel = 1 reg_addr = 12 result = FF
12: 27: 45.202 -> WriteRegister channel = 1 reg_addr = 12 val = FF
12: 27: 45.235 -> ReadRegister channel = 0 reg_addr = 20 result = FF
12: 27: 45.302 -> ReadRegister channel = 0 reg_addr = 18 result = FF
12: 27: 45.335 -> WriteRegister channel = 0 reg_addr = 18 val = FF
12: 27: 45.368 -> WriteRegister channel = 0 reg_addr = 0 val = 3
12: 27: 45.435 -> WriteRegister channel = 0 reg_addr = 8 val = 0
12: 27: 45.468 -> WriteRegister channel = 0 reg_addr = 18 val = 7F
12: 27: 45.501 -> Desired baudrate: 9600
12: 27: 45.535 -> Calculated divisor: 3
12: 27: 45.568 -> Actual baudrate: 9600
12: 27: 45.601 -> Baudrate error: 0
12: 27: 45.601 -> ReadRegister channel = 1 reg_addr = 22 result = FF
12: 27: 45.669 -> ReadRegister channel = 1 reg_addr = 1A result = FF
12: 27: 45.702 -> WriteRegister channel = 1 reg_addr = 1A val = FF
12: 27: 45.736 -> WriteRegister channel = 1 reg_addr = 2 val = 3
12: 27: 45.803 -> WriteRegister channel = 1 reg_addr = A val = 0
12: 27: 45.836 -> WriteRegister channel = 1 reg_addr = 1A val = 7F
12: 27: 45.869 -> Desired baudrate: 9600
12: 27: 45.903 -> Calculated divisor: 3
12: 27: 45.936 -> Actual baudrate: 9600
12: 27: 45.969 -> Baudrate error: 0
12: 27: 45.969 -> ReadRegister channel = 0 reg_addr = 18 result = FF
12: 27: 46.036 -> LCR Register: 0x192
12: 27: 46.036 -> WriteRegister channel = 0 reg_addr = 18 val = C3
12: 27: 46.103 -> ReadRegister channel = 1 reg_addr = 1A result = FF
12: 27: 46.136 -> LCR Register: 0x192
12: 27: 46.171 -> WriteRegister channel = 1 reg_addr = 1A val = C3
12: 27: 46.204 -> WriteRegister channel = 0 reg_addr = 38 val = 55
12: 27: 46.237 -> ReadRegister channel = 0 reg_addr = 38 result = FF
12: 27: 46.305 -> Device not found

Output 0xFF ...


I wrote a little code and it works at 0x4D. Detects pin when connected to ground.

#include <Wire.h>

void setup() {
Serial.begin(9600);
Wire.begin();
}
void loop() {

uint8_t reg_addr = 0x0B;
uint8_t channel = 0x00;
Wire.beginTransmission(0x4D);
Wire.write((reg_addr<<3 | channel<<1));
Wire.endTransmission(0);
Wire.requestFrom(0x4D, 1);
uint8_t c = Wire.read();
Serial.println(c, HEX);
delay(1000);
}

from sc16is752.

nopnop2002 avatar nopnop2002 commented on June 29, 2024

The i2c address is based on the following table.

https://github.com/nopnop2002/SC16IS752/blob/master/Arduino%20%26%20ESP8266/SC16IS752.h#L38

I2c scanner transmits the address is 0x4D:

SC16IS752 i2cuart = SC16IS752(SC16IS750_PROTOCOL_I2C,SC16IS750_ADDRESS_BB);

from sc16is752.

ArduinoGo avatar ArduinoGo commented on June 29, 2024

I still do not understand why your library sends 0xFF in response.

I studied your library and module documentation.
And using it, I managed to record and receive data from the registers at the address 0x4D.

In the documentation when working with ESR you need to write 0xBF to the LCR. Studying your code, I never found a translation into this mode. In doing so, you are trying to work with ESR O.o

As I understand it, the microcircuit has its own addresses, and the module uses another (with a shift to the right). This should have been indicated in the examples. But I still did not work.

There will be time to see why your library does not work for me. Although everything does the same.

But the main thing is that the module itself still works! )))

from sc16is752.

nopnop2002 avatar nopnop2002 commented on June 29, 2024

1.Try to
A0=5V
A1=5V
SC16IS752 i2cuart = SC16IS752(SC16IS750_PROTOCOL_I2C,SC16IS750_ADDRESS_AA);

2.Try to SPI


This module does not work with 3.3V power supply.
Because the regulator is mounted on the module, it converts 5V to 3.3V and supplies it to the IC.
If you were supplying 3.3V power, the IC would only receive about 2V.

from sc16is752.

ArduinoGo avatar ArduinoGo commented on June 29, 2024

I already wrote that the module is working)
It works also from 3.3V, but yes it lowers all output voltages on the module.

p.s.
I took the time and looked at your library why it does not work for me.

Everything is very simple, except for the problem with the I2C address, the problem is still this:

#ifdef AVR
#define WIRE Wire
#elif ESP8266 // ESP8266
#define WIRE Wire
#else // Arduino Due
#define WIRE Wire1
#endif

Really very strange announcement of the WIRE constant for different microcontrollers%)

Because of this, it did not work for me with ESP32.

In general, the question is closed) I will write my library for my projects. Yours is still very raw. There is still a problem with ESR registers.

Good luck with the past holidays!)

from sc16is752.

nopnop2002 avatar nopnop2002 commented on June 29, 2024

Thank you for your report.

from sc16is752.

Related Issues (16)

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.