Why am I getting this error (attached), all the pins are on the same port:
The message talks about "physical port". Although you named the pins "Port2" you have to specify under the "Mappings" tab that the pins belong to the same physical port.
Yes, I did that
In the pin mappings, "Port2" is configured to use P2[7:0]
I just tried configuring each pin separately instead of all 8 in one, but now getting:
"Invalid pin assignment. ''Pin_2' is already assigned to physical port 2 and uses interrupts. Only one component assigned to a single physical port is allowed to use interrupts.' Either press Esc to cancel the edit or enter a valid assignment."
Whever I try, I get an error. If I try to configure all 8 pins with interrupts enabled, I get an error stating to uncheck the "contiguous" box. When I uncheck that, the "Spanning" box becomes automatically checked and greyed-out which immediately throws up another error saying "When interrupts are enabled, spanning is not allowed".
Nothing I want to do is working. Also sometimes it wont let me click anywhere in Creator except the pin assignment area so I have to close and reopen the program.
What I am trying to do is configure 8 pins (all of P2) to be analog and digital. Interrupt on falling on all pins. I will switch between analog and digital in software and enable/disable interrupts as required in software. But I need to place them with interrupts in order to generate the interrupt vectors. I need them to be analog to be able to place an analog mux bus which they can potentially be connected to in software.
This is a design I am porting across from a PSOC 1 where none of this was any problem (ie dynamic reconfiguration).
Can you post your complete project, so that we all can have a look at all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
To simplify things I placed the parts on one of the example projects.
Try enabling interrupts on Port2 pins.
Ideally in the pin listing I would prefer the pins to be one entry P2[7:0] but even with them separate as shown, I cant enable interrupts.
The errormessages shown are quite clear: You cannot use interrupts on a port using analog pins,
Adding one single pin configured as analog and digital allows enabling of interrupts without any problem.
Thats probably what I need to do, add each pin separately, but doing that, I can only enable interrupts on one pin of any specific port. Is this normal? This is the same when the pin is not configured as analog so its not an analog issue.
A supplementary question: The reason for enabling interrupts is to keep awake with GPIO activity. But it isnt waking. I guess I need to add some wake command in the ISR but what?
Edit: I just received a reply for a case I raised which goes some way to help:
1. The Analog pins cannot be used with contiguous pins.
2. The pin interrupt requires contiguous pins, since all the pin interrupts of a port are ORed to a single port interrupt.
The possible option would be to use the interrupt component connected to the digital input pin rather than connecting it to the IRQ terminal of the pin.
Yes, the errormessage says for more than one analog pin interrupts on same port are not allowed.
Since interrupts just work on digital levels and your analog is limited to 1.024V it is questionable if it might work at all.
Seems easier using a comparator to generate an interrupt.
I am not expecting interrupts to work in analog mode, the reason for needing the pins to be defined as analog is simply to allow me to place the AMUX.
If it would let me place the AMUX without anything connected to it I would not have any problem. Changing a pin from digital to analog in software and connecting it to the AMUX is easy to do.
The AMUX requires its inputs to be connected to something in the schematic otherwise it assumes you dont want to use it and optimises it out of the design.
I will try and find a way to cheat this by connecting the AMUX inputs to some dummy component.