i have big problems with the AD2S1210. Configuration works fine. I check the values coming from the ad2s to ensure that he recived the right values.
After configuration i make a fault clear. This is my sequence:
(CS_N and WR_n are low)
uint8 adress = 0xFF; uint8 dummy = 0x7A;
LPSPI_DRV_MasterTransferBlocking(res_spi_config.instance, &adress , &return1, 1, 100); LPSPI_DRV_MasterTransferBlocking(res_spi_config.instance, &dummy , &return1, 1, 100); LPSPI_DRV_MasterTransferBlocking(res_spi_config.instance, &adress , &return2, 1, 100);
gpio_set(IO_l_res_samplen, HIGH); vTaskDelay(xdelay); //wait 20us
gpio_set(IO_l_res_samplen, LOW); vTaskDelay(xdelay); //wait 20us gpio_set(IO_l_res_samplen, HIGH);
LPSPI_DRV_MasterTransferBlocking(res_spi_config.instance, &adress , &return1, 1, 100); LPSPI_DRV_MasterTransferBlocking(res_spi_config.instance, &dummy , &return1, 1, 100); LPSPI_DRV_MasterTransferBlocking(res_spi_config.instance, &adress , &return3, 1, 100);
I think this works fine so far.
After that i switch to normal mode and read position and velocity in a while loop.
test_lot = gpio_get(IO_r_res_lot); test_dos = gpio_get(IO_r_res_dos); gpio_set(IO_r_res_csn, LOW);
//Sampling of Position is triggered at high low transition gpio_set(IO_r_res_samplen, HIGH); gpio_set(IO_r_res_samplen, LOW); //wait min 500ns //const TickType_t xdelay = TICKSPERUS / 2; // vTaskDelay(xdelay);
gpio_set(IO_r_res_samplen, HIGH); //wait 500ns // vTaskDelay(xdelay);
//Position output: A0=0, A1=0 gpio_set(IO_r_res_a0, LOW); gpio_set(IO_r_res_a1, LOW);
//Chips sends a 24 bit word, first 16 are theta, 8bits fault register
receive = SPI_ReadNormal(res_spi_normal, RIGHT); shift = receive >>8; omega = (int16)shift;
shift = receive; shift = shift &(0x00FF); shift = shift <<8; faults= faults|shift;
//Velocity output: A0=0, A1=1 gpio_set(IO_r_res_a0, LOW); gpio_set(IO_r_res_a1, HIGH);
//Chips sends a 24 bit word, first 16 are omega, 8bits fault register
receive = SPI_ReadNormal(res_spi_normal, RIGHT); shift = receive >>8; theta = (uint16)shift;
shift = receive; shift = shift &(0x00FF); faults= faults|shift;
I receive the same faults in both reading sequences. DOS Pin is low, LOT Pin is high. So i think my reading function works.
The fault bit D4 is set to one. According to the documentation i have problems with dos mismatch. How can i fix that?
(I receive for the position 0 or the max value)
Here some differential measurements with the oscilloskop at the highest point:
I my eyes everthing looks right. Their is a difference between sin and cos, but the gap is smaller as the default dos mismatch threshold.
Can the small edges lead to the failure?
To make this description complete i will list my config for the ad2s:
DOS overrange threshold: 0x6B
DOS mismatch threshold: 0x0C
DOS Reset max threshold: 0x53
DOS Reset min threshold: 0x4A
LOT high threshold: 0x23
LOT low threshold: 0x07
EXC Frequency: 0x28
Control Register: 0x7A
Can you please explain how the dos mismatch failure is triggered and how i can fix it?
Chances are the read rate you are running at is sufficiently fast to prevent the IO from ever toggling because you are clearing the faults internally (by reading and clearing it) to quickly…
So from your description I assume SOE\ is 0 and you are using SPI.
The first thing I would note is that I would just push the ADDRESS for the fault register during your fault clear sequence as we're trying to read the contents of a READ ONLY REGISTER (no write to clear operation); so I don't think you have a need for your dummy packet.
dynamics_eV said:WR_n are low)
Secondly I would allow WR_N to be controlled via your SPI writes and that the appropriate timing as specified in the datasheet is observed. WR_N is used to frame the instruction and if not toggled between bytes could lead to issues with the interface.
Secondly could you clarify how you are driving the input to the part. It appears that the scope represents a differential measurement between SIN, SIN_LO and COS, COS_LO pairs but the lack of a simultaneous capture of the two makes it difficult to understand what is really going on at the input.
Finally, be careful with the settings of DOS RESET MAX and DOS RESET MIN. These values are preloaded into the internal monitor MAX/MIN detection logic and if incorrectly set will prevent the actual signal min and max from being stored so you could end up inducing a fault accidentally. What happens if you skip writing your values and just use the defaults? Also be careful with your LOS and DOS threshold settings. As currently set the input amplitudes could go outside the accuracy range (2.0Vpp-4.0Vpp) specified in the datasheet and you could have measurement errors outside expectation and not be flagged because you've opened up the detection limits.
your assumptions are right. SOE/ is 0 and i using SPI. Also i WR_N is controlled by SPI. Sorry for that.
I fixed the reading from the fault register. Now i only sending the adress.
After that i skipped my configuration part. Before entering normal mode, i only resetting the fault register.
Sadly, this had no effect. I still get the fault bit.
I increased the dos mismatch threshold value till i got no error. This happened at, 2,698V (very high).
Also i made some simultaneous captures witch the scope. I only have one differential probe (green, COS). So i captured SIN by computing the difference (white). The differential probe leads to slightly higher amplitudes and to a offset. This happens by sin and cos, so i think that has something to do with the differential probe.
I rotated the resolver (one pole pair) 45° between two captures.
Can you comment on how you are generating the input signals? Is it from the output of a resolver?
The reason I ask is that the SIN/COS generation appears to be either in phase or 180 degrees out of phase and I would expect a 90degree shift. I also find it strange that I don't see the carrier in your waveforms as well.
Yes, it's the output of the resolver. LTN RE-15 with one pole pair.
Sorry I see my mistake now and I realize I'm looking at the carrier not the envelope.
Couple of questions.
1) Did you try restoring DOS_MISMATCH, DOS_RESET_MAX, DOS_RESET_MIN to their defaults and not program them?
2) Can you verify how you have the STATOR Outputs connected to the RDC chip? I'm curious if the SIN and COS inputs are swapped. If so this could generate a larger than expected ripple in the monitor signal and cause the DOS_MISMATCH to flip.
So if I'm correct your resolver should be connected as follows.