Comments (8)
_status.dr is updated through a union based on the result of a function call. See the source which defines the structure below, specifically line 113.
Arduino_MCP3x6x_Library/MCP3x6x.h
Lines 108 to 121 in c9de707
IRQ_handler
calls the read
function, which calls the transfer
function, which in turn sets the value of _status.dr
based on the result of the SPI transfer
Arduino_MCP3x6x_Library/lib/MCP3x6x/MCP3x6x.cpp
Lines 80 to 90 in 6cce101
Is _status.dr not updating? If it isn't try using the develop
branch since commits to that branch may solve your issue.
from arduino_mcp3x6x_library.
Hello Mirageofmage,
Thank you very much for fast reply.
In the "_transfer" function sets the "_status.raw" value
which part of the "_transfer" function changes the “_status.dr” logic?
Thanks.
from arduino_mcp3x6x_library.
_status.dr
is just one bit within _status
. as all mcp3x6x do full duplex, and the first byte read back corresponds to the status, the return value of spi->transfer(addr)
corresponds exactly bit aligned to this status, just like Mirageofmage pointed out with the status_t union
from arduino_mcp3x6x_library.
@arthanth is this some real issue or are you just trying to understand the code? if first please specify your problem.
from arduino_mcp3x6x_library.
I use MCP3564 (ADC 9 Click) with ESP32 (Wemos D1 R32 pinOut-R32). Voltage incorect value it show 0 and 2.39 in mux mode. I try to fix follow the previous issue but it does not work now. So I am trying to understand the code and debuging.
from arduino_mcp3x6x_library.
Voltage incorect value it show 0 and 2.39 in mux mod
You should check the configuration 0 register of your MPC3564. The default Voltage Reference is set to 2.4V.
And also check ADCDATA REGISTER if the result is what you expected.
from arduino_mcp3x6x_library.
a few more thoughts:
- check if you got a version mcp3x6xr or without r, the once without r do not have VREF_SEL. did you connect anything to VREF+-?
- it helps a lot to have a logic analyzer / oscilloscope running in parallel to your SPI
- I just checked if the code builds for ESP32, but never actually connected one. you might need to change
_spi->begin();
adding the actual pins. Also just yesterday figured out there is a_spi->transfer32();
for at least some ESP32 variants... should not matter to you, but might help to speed up communication.
- I just checked if the code builds for ESP32, but never actually connected one. you might need to change
mcp.begin()
does set some defaults, which are not necessarily the defaults according the datasheet. all settings done by you (select channel, clk_sek, vref, gain, timing, ...) should be done after thebegin()
from arduino_mcp3x6x_library.
I am closing this as no actual question/issue seems open. please feel free to come back if you run into troubles again.
from arduino_mcp3x6x_library.
Related Issues (11)
- Problems with SDO on MCP3464 HOT 3
- Some questions about the SPI HOT 4
- Strange issue with MCP3561 HOT 3
- How do I add license in my source code ? HOT 2
- ESP32-S3-Mini and MCP3462R not working in Mux Mode HOT 24
- mcp 3462 with Arduino Zero definition-question not issue! HOT 6
- Not really an issue :) HOT 3
- Get stuck in mcp.analogRead loop HOT 7
- Function: _getValue(uint32_t raw) wrong return HOT 8
- Difficulty with compiling for RP2040 using earlephilhower core HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino_mcp3x6x_library.