2022-06-17 05:38 AM
PCA is managed by a full-duplex serial interface. A typical data frame is defined by
a burst of 8 DCLK pulses followed by an assertion of a DLOAD pulse (these lines are driven by the host printing system.). During each frame, 32 bits of control or print data (16 bits each, on DIN_1 and DIN_2) are transferred from the host printing system. Input data (to the controller ASIC) is clocked on both the rising and falling edges of DCLK.
I have also attached a waveform image.
I have also written a code, it works perfectly but the speed is too slow.
code:
HAL_GPIO_WritePin(DLOAD_GPIO_Port, DLOAD_Pin, GPIO_PIN_RESET);
for (int i = 0; i < 8; i++)
{
c = din2 & 1;
d = din1 & 1;
uint16_t e = 0x0000;
e = e | c;
e = e << 1;
e = e | d;
din2 >>= 1;
din1 >>= 1;
GPIOB->ODR = e; //Write to port-b
HAL_GPIO_WritePin(DCLK_GPIO_Port, DCLK_Pin, GPIO_PIN_SET);
c = din2 & 1;
d = din1 & 1;
e = 0x0000;
e = e | c;
e = e << 1;
e = e | d;
din2 >>= 1;
din1 >>= 1;
GPIOB->ODR = e; //Write to port-b
HAL_GPIO_WritePin(DCLK_GPIO_Port, DCLK_Pin, GPIO_PIN_RESET);
}
therefore anyone can suggest a better method to implement the desired waveform.
Either SPI or I2c can be utilized or not. because both can transfer data on a single gpio pin.
2022-06-17 05:53 AM
I have to say I've never seen a protocol that clocks on both edges, but it makes sense since if the clock can transition that often then the data at that "speed" should be able to get there as well.
Please provide some links for this protocol (or is it internal/proprietary?)
Possibilities:
1. Interrupts on both clock edges for reading/writing data
2. Use DMA to Rx/Tx bunch data, with post/pre processing to arrange bits/bytes.
3. Use a clock doubler/halver (Several options depending on existing circuits: FlipFlop, PLL, etc).
(Serve me some rum and I'll have more ideas)
Paul
2022-06-17 06:03 AM
Perhaps use TIM in Input Capture, capture both edges, have the capture generate a DMA request, service that as a write to GPIO->BSRR or ODR from a pattern buffer.
2022-06-17 06:14 AM
Concern: Jitter
Paul
2022-06-17 08:34 AM
Use timer to generate clocks: using PWM mode to generate single-edge clock on one channel and Toggle mode to generate double-edge clock (DCLK for the target) on second channel. Connect externally the single-edge clock to SCK pins of two SPI modules set as slave and preloaded by data, and run the timer to generate 16 single-edge clocks = 8 double-edge clocks (e.g. using TIM1/TIM8 with RCR set to 16 and One-Pulse mode).
JW
2022-06-18 06:09 AM
Your code is extreme unefective. Too you dont write MCU type and clock. Normal M0 gpio can handle 25MHz and M4 90MHz ... And maybe perfect for you is DDR QSPI mode.
2022-06-19 11:12 PM
Serial Data Transfer Protocol:
Communication between the host printing system and the controller ASIC on the PCA is managed by a full-duplex serial interface. A typical data frame is defined by a burst of 8 DCLK pulses followed by assertion of a DLOAD pulse (these lines are driven by the
host printing system.). During each frame, 32 bits of control or print data (16 bits each, on DIN_1
and DIN_2) are transferred from the host printing system. Then 8 bits of status or measurement
data are returned to the host printing system from the controller ASIC. Input data (to the controller
ASIC) is clocked on both the rising and falling edges of DCLK. Output data is clocked on the falling
edge of DCLK and should be latched in by the host printing system on the rising edge (BIT 0 of the
output data word is placed on the DOUT line in response to DLOAD transitioning low at the end of
the previous frame.).
A low-to-high transition of DLOAD causes status or measurement data within the controller ASIC to
be latched into the output shift register and Bit 0 of the output data word to be placed on the DOUT
line. While DLOAD is in the high state, the internal DCLK counter in the controller ASIC is halted
and the I/O shift registers are disabled. When DLOAD returns to a logic low, the contents of the
controller ASIC input shift registers are transferred to the appropriate control or print data registers.
If the input data word is a control word and contains a valid analog-to-digital converter channel
address, the falling edge of DLOAD will also initiate A/D conversion.
It is imperative that there be no more or no less than eight (8) rising and falling **** edges while
DLOAD is low. This will prevent data corruption due to under-run or over-run of the driver ASIC
input shift registers. Any extraneous transitions (such as gating spikes) that occur on the DCLK line
when DLOAD is in the low state will be interpreted as valid clock edges and must be avoided. This
is important during transfers of print data blocks where false clocking can cause print data words
(DIN_1 LSB=0) to be interpreted as command words (DIN_1 LSB=1).
this is the whole serial transfer protocol. my code is too slow as DCLK can be set at max 5.33Mhz.
DIN1 and DIN2 are the input for the ASIC. but for microcontrollers, they act act as outputs(DIN1 and DIN2). I have to transfer data from DIN1 and DIN2 to ASIC at max speed.
but I am unable to do that.
i am using STM32F407. Microcontroller clock(HCLK) = 150Mhz.
TIM1 is used for microsecond delay.
TIM2 is used for nanosecond delay.
TIM3 is used for PWM.
TIM8 is used for ENCODER.
.
2022-06-19 11:19 PM
I need to send data through DIN1 and DIN2 to ASIC.
so how input capture can be used?
2022-06-19 11:20 PM
MCU Clock = 150Mhz.
Maybe it will take a lot of memory. As data can be Mbyte long to process.
2022-06-19 11:22 PM
my code is ineffective, that's why it takes much time. I am using STM32F407 which does to have QSPI mode.
I need alternative ideas to solve my problem.