how can we send binary data on two different pins simultaneously on both the rising edge and falling edge of dclk whose speed can be 1MHz on stm32f4?
- June 17, 2022
- 14 replies
- 3466 views
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.
