Register Value and Memory Address for Read and Write for MAX144 ADC - stm32

I am using MAX144 ADC and in the Datasheet there is no information given about the control register to read the ADC values. I am using STM32L452RE micro-controller and using SPI to get data from ADC. Datasheet of the ADC is:
https://datasheets.maximintegrated.com/en/ds/MAX144-MAX145.pdf
anyone who encountered the same problem please guide.
my idea is to create a buffer of 2 bytes for SPI RX and store values in it. but i don't know what control register address should be assigned to it.

The conversion data is not stored internally in a register set. When you pull CS low the state of SCLK will determine wither it holds the conversion product(after a high to low transition to start it) or start streaming it on the falling edge of the second clock pulse.
This is all noted on page 9 of the data sheet. Pages 10 & 11 detail how to interface them to standard SPI.

Related

How to read data from external ADC MAX144 using STM32 microcontroller

I am facing a problem for last week in reading data from external ADC MAX144 using SPI and STM32L452. The confusion is how to receive data in buffer as there is no memory address or control register address is mentioned in the datasheet of ADC. The datasheet ADC is given below.
https://datasheets.maximintegrated.com/en/ds/MAX144-MAX145.pdf
What I tried is:
I made a buffer of 2 bytes. (static unit_8 readBuffer[2])
Then used receive command of HAL SPI ( HAL_SPI_Receive(&hspi3, readBuffer,
2, 5000)
And transmit through USART to PC
The confusion is I am not giving any memory address or control register address for reading data as nothing about registers is mentioned in the datasheet of ADC and it is continuously sending data.
Please guide me someone has any idea about it. I stuck in this problem but don't understand it. Any leads will be highly appreciated.
Regards,
I think the ADC stream the ADC output directly on the SPI data line, so there is no register to store data on the ADC

How to read the full length of modbus RTU holding registers (Add 40001 : 49999)?

I'm using J2mod to communicate with HW over Modbus RTU and my scope is to read holding registers from address 40001 to 49999.
The problem is the Modbus frame max no of registers is 125 / request.
and i want to read almost 10000 registers, how to apply this because if i will apply for loop each loop reads only 125 registers then to complete the full scan cycle the time will be too too long.
so what is the best practices for this case?
Regards
Hani

STM32F302 Adc with DMA for different size and channel

I'm using STM32F302 QFN32 and unfortunately, it has only one ADC module. One channel must get around 500 samples in one period and it must be sync with and PWM (thinking using a timer and this i/o will be toggled in callback, because while reading its ADC channel, I must know the i/o whether high or low, so that according to this value, will decide value). Furthermore, there are 4 more channels which must be read.(More samples doesn't need there like before, 8 or 16 samples will be enough.) However, it has only one ADC module. Consequently, Can I do this? If yes, how? Thank you.
ST ADC have two conversion modes. Regular and Injected.
Regular mode is like all ADC's have. You start it, either by software or trigger (timer/gpio) and it does one or a sequence of conversions. The result is written to a common register, that the DMA takes care of.
Injected mode is a high priority preemption conversion. Once you start an injected conversion sequence by software or trigger. The ADC injects the conversion between the regular conversions. As a higher priority one. The result is stored in one of the injected result channel for the interrupt.
Only regular mode supports DMA. See AN4195 for more info.
I suggest you use a timer to trigger a regular sequence for your fast channel, with a circular DMA setup to move the data. And use another timer to trigger the injected sequence. There is a maximum of 4 injected channels, so you are in luck!
Obviously, you can do this the other way around. Have fast injections and slow regular. But you'll need another timer synchronized to the injected start trigger to get the DMA to move the data.
That is, if your samplerate does not allow immediate processing. Otherwise you can just use the ISR.

IC2 SLAVE NOT RESPONDING XC8

Hey guys i've been working on this like 72 hours straight and i can't find the error, i'm working on a PIC16F1719 i'm trying to set 3 peripherials an ADC a I2C Protocol and a USART for comunicating to a BT however the ADC was easy, but i'm having a rough time with the I2C despite the fact i've check the code several times, for some reason when i get the ACK's everything seems OK, but when i go for a lecture on the sensor (MPU6050) nothing shows up but the value i putted last time on the buffer, any ideas why this is happening? It's like the buffer doesn't clear itself and i think i canĀ“t clear it through software, thanks.
i2c slave has the ability to lock the bus if the master does not communicate correctly with it (several possible scenarios...)
This is electirically possible since the 2 wires are wired-and, that means if any slave pulls the clock (for example) down, and keeps it that way, the bus is locked.
Always check first the values on both wires (using scope or dvm), if '0' it means bus locked.
Next test the status register of your i2c controller, it may show arbitration error or something of that sort.
If any of the errors, read the i2c slave part datasheet carefully to check what types of protocol read/write it expects and fix your code.

UDR (UART data register)issues

I can't understand the meaning of the following "The USART Transmit Data buffer register (TXB) and the USART Receive Data buffer register (RXB) share the same I/O address" there is two data register .how they share the same address ?
Now it's clear
From the diagram you see that The transmitter and receiver share the UDR (UART Data Register). Actually they only share the UDR address: The "real" register is divided into the transmitter and receiver register so that received data cannot overwrite data being written into the transmit register. Consequently you can't read back data you wrote into the transmitter register.
The register address is the same for both TXB and RBX and the actual addressed register is determined by the modality in which the UART is (reading or writing mode). This is depended on the actual implementation, but usually it consist in setting one or two more pins.
You can consider UDR register as the buffer between TXD and RXD registers.
As you know UART is sent bit by bit in the bus, While recieving the bits is entering the RXD register, when all the byte is being recieved it copied to UDR register and the flag is raised, now you should read the UDR register and if you write to it you will lose the recieved byte!!
By the same way in transmission, you write the a byte in UDR then it moved to TXD then output from registerbit by bit and the UDR is empty during transmission.
That's why there is interrupt for UDR, when the UDR becomes empty, and interrupt for TXD, when trasnmission is completed.