Hi Guys, I'm having a serious problem with my PXD20 176pin LQFP 120Mhz. I'm using Masked Parallel mode which writes the full 16bits to a port in one cycle. I have 16 LEDS connected to each port. I write to PORT B ( 14 bit port ) and all 14 LEDS light up with no probs. I write to PORT C ( 16bit port ) and PC0 and PC1 does not light up. PC2 to PC15 light up.
PORTD is a 16bit port and the same thing as PORT C. PD0 and PD1 LEDS do not light up.
The PXD20 reference manual says masked port address is BASE+0x0C80 for PORT A, PORTB 0x0C84, PORTC 0x0C88, PORTD 0x0C8C and so on. 32bit registers.
I wrote to each of the port pins individually and all LEDS lit up including PC0 & PC1 and PD0 & PD1 so I know my LEDS are on the correct pins on the MCU.
It should be writing the full 16bits to the 16bit ports but its only writing 14 bits. Heres my assembly example:
lis r29,base+0x0C88@h // PORT C MASKED PARELLEL REGISTER address
ori r29,r29,base+0x0C88@l
lis r28,0xFFFFFFFF@h // Upper 16bits = which bits to change.
ori r28,r28,0xFFFFFFFF@l // lower 16bits = the 16bit data to put on the port.
stw r28,0(r29) // write 32bits to PORTC. 32bit writes is only allowed. 8 or 16bit is not.
This should turn ALL 16 LEDS on PORTC but only 14 LEDS turn on. PC0 and PC1 does not turn on.
I checked the voltage on PC0 and PC1 and both 0V so they are not turning on.
As I said before, if I set the pins individually PC0 and PC1 work fine, same with PD0 and PD1.
OK, thats about it. Please help as I need to write full 16bits to a port in one cycle.
Thanks guys, hope to hear from you soon.
Pete.
Solved! Go to Solution.
Hi, isn't it the same problem already discussed here:
Hi, isn't it the same problem already discussed here:
Hi David, writing to the PCR registers individually is too slow. I need to write 16bits to a port in one clock cycle and the masked parallel mode is perfect for doing this but it does not work. Only 14bits is set on the port. Sure setting the bits manually works but its way to slow.
Can you put 16 LEDS on PORTC and write 16bits using the masked parallel mode and 14bits will only change.
The manual says update 16bits in a clock cycle but it does not work. Is there a BUG in the chip or am I doing something wrong?
Pete
How I already answered
PCR number always fits to PDO number.
PPDO[x][y] = PDO[(x*32)+y]
PCR30-45:
x*32+y=30 => PPDO[0][30]
x*32+y=45 => PPDO[1][13]
PCR46-61:
x*32+y=46 => PPDO[1][14]
x*32+y=61 => PPDO[1][29]
Port name does not have any relevance. Parallel write works with group of pads according its PCR number.