Main Site Documentation

?Can the Cerb40 pin PB5 be used for anything other than SPI?


I have been struggling with the Cerb40. Behaviour is simply not as expected. I can’t use PB5 to source output (, and now it seems I can’t use PB5 for input. Regardless of the physical connections, it always reads high. Is there anything I can use PB5 for beside SPI? I’m having other input issues, but I’ll get to those after PB5 is clarified. Does the Cerb40 only have 33 I/O pins?

I’m using 3 pins are power (3v3 and 5v) and ground, 1 is Boot/Loader, 1 is Reset, and 1 is VBat. That leaves 34 pins. Of those, I am using 2 for UART, leaving 32 for GPIO. I want 16 input and 16 output. Is that possible? Seems not…


I do not see why this pin will not work for output and then later not input, unless the pin was damaged with overloading it to static discharge.


@ Gus - You had mentioned static discharge damage in the other thread, so I bought another Cerb40. I’ve been very careful, and don’t see how I could have damaged the exact same pin 3 times now. If the Cerb40 is that fragile, I can’t possibly base my product on it. But I have trouble believing that is the case.

I’ll be the first to admit I don’t know much about electronics. Everything I’ve learned, other than some basics in college Physics and rudimentary soldering skills, I’ve learned since buying a Panda II. I’d like to think I’m a fairly quick study, but this has me feeling like an idiot.

How do I use PB5 as an output? Sink (only)? How do I use PB5 as an input? I certainly can’t pull it low by setting the internal resistor to pull-down, can I, because it has a 10k pull up on it, right?

I guess what’s throwing me off is that some pins work exactly as I expect, and others don’t. I am using PA4, PB5, PB14, PB15, PA0, PA1, PA2, PA3, PC6, PC7, PC8, PC9, PC12, PC11, PC10, PA13 for input. I set the pull down resistor on each of them. Here are the reads:
PA4 = low
PB5 = high
PB14 = low
PB15 = low
PA0 = low
PA1 = low
PA2 = low
PA3 = low
PC6 = low
PC7 = low
PC8 = low
PC9 = low
PC12 = low
PC11 = low
PC10 = low
PA13 = low

Then, I apply 3v3 to each in turn, skipping PB5 since it is already high, despite the pull down resistor. Here are the results:
PA4 = high
PB5 = untested
PB14 = high
PB15 = low
PA0 = high
PA1 = high
PA2 = high
PA3 = high
PC6 = low
PC7 = low
PC8 = low
PC9 = low
PC12 = low
PC11 = low
PC10 = low
PA13 = low

Then I set the pull-up resistor on PC* and PA13. They should read high, right? They all read low. No sense in grounding them, it won’t change the state. I’m using two pins for UART (Com3) and the rest of the pins for output, successfully sourcing current from each. How much of this is a problem with the Cerb40, and how much is a problem with my expectations?


Did you test them one at a time or you have instantiated all InputPorts in the same test application?


I have instantiated all InputPorts in the same test application, using a newer version of my “command shell” ( ). The input code should be the same as what is in the codeshare, however. Perhaps I was a bit overzealous in hooking up all 16 inputs and 16 outputs, but I don’t see where that would make a difference. Enlighten me.


What all have you physically connected to PB5? Is the code that deals with PB5 any different than on the link you posted at all? I was able to get PB5 on a stock Cerb40 to act as an input and output with no problem.


@ John- Thanks so much for the verification. Apparently, two of my three Cerb40 are damaged. I was distilling the problem down to it’s essence, and now PB5 is behaving appropriately as output. Perhaps I was mistakenly working with the second instead of the third when I posted. Perhaps I made some other hair-brained mistake, I don’t know.

All I can say is, once I popped the Cerb40 into my new board, outputs, including PB5, are working fine. I haven’t yet tested inputs, but I anticipate success.

To answer your questions, I have PB5 connected to a resistor->LED->GND. The relevant pieces of code have not changed, but I have added quite a few commands to the code.

I’ve been rather confused about PB5 and it’s pull-up resistor, but thanks to your help and others’, I kept plugging away, convinced that it had to work. Everyone else couldn’t be wrong! Thanks again.


Glad it worked. Hopefully input works as well.


@ Gregg - Nice looking board you have there! :slight_smile:


My thoughts too ! Is that Texas (not knowing my US geography isn’t a sin is it ? :slight_smile: )


That most certainly is Texas. However, I’m fairly certain that owning something that small is illegal in Texas :wink:


@ Architect - Thanks! Had it manufactured via Electrodragon (<$30 for 10) . Shamefully, though, I designed it in Pad2Pad, so no Eagle files. I printed it to PDF, then had to convert the “circles” (rectangles with a circular bounding path!) to bezier curves so PDF2Gerb ( ) could convert it to usable gerbers.

@ Brett - As Ian said, yes that is Texas, with an LED marking Sachse (my home), essentially Dallas at this scale. It’s my logo.

@ Ianlee74 - Fortunately, there are plenty of large items to hide it behind, and plenty of firearms with which to defend it :).

If anyone is interested, I’d be happy to share my program to convert P2P PDFs to a format convertible by PDF2Gerb. I’m hesitant to publish it widely, however, for fear that P2P will change their output to subvert it.

I’m considering a Kickstarter campaign to produce the board en masse. Or perhaps a Community Offer through GHI. Any opinions on this? I’ve coded it to be 16 digital input, 16 digital output, and would offer it as such on Kickstarter, but the board itself is essentially a breakout board to RJ45 connectors.


@ Gregg - Interesting link. Never heard before about designing boards in Adobe Illustrator.