I try to build a little terminal with the rc522 rfid reader chip ( on a tiny module from ebay ) and a OLED Display ( SSD1306 also SPI bus but in UDB mode because no chip select wire ) and of course the MIGHTY PSOC 4 ^.^
I have a tiny Arduino due which works as expected. RFID reader hooked up OLED hooked up, Software written and it works.
So i have a definite working Reader and Display.
I hooked up the Display to the PSOC and started to write the Software to control it. Long Story many failures but finaly it works now. Also i got it managed to work with some GFX functions like circles Sprites and and and ( also a little Font ).
But the reader refuses to work. I even dont know if the communication works as expected because in the rx buffer are always values which are not expected. 0xE0 mostly.
Has anybody managed to get this reader working with a SPI_SCB component ???
I make a try with good old static BitBanging but mhm I dont know what happens.
Typical errors regarding SPI: each write is also a read, so it produces an entry in the RX FIFO. Also, you need to wait for the SPI transfer to finish before you read the Rx FIFO. And when the SPI clock is fast enough, you might not fill the TX buffer fast enough so it disabled the SELECT signal inside of a transmission.
Best is to check the signal lines with a logic analyzer or a scope.
Okay about that im aware.
I connected the reader without the chip select to the SCB Block. I control the CS pin seperate in code.
So i pull the CS low ( Active LOW ) then i make the TX WRITE wait until TX finished and then i Release CS back to HIGH ( CS_Write(1))
They do it the same in the Arduino Source.
I found also in a different post a Sniped for Readback the Value directly while sending but this also dont work as expected.
Tomorrow Ill walk over to the ETHZ ( University here ) and ask in the Laboratory for a hint with the Logic Analyser.
I think ill build myself a tiny one to check it. I got a nice Sourcecode for a PSOC5 Variant with included Scope from Someone AKA hlipka Maybe i get it only as LOGIC ANALYSER working. with the SSD1306 it would be awesome. little scale but AWESOME. Ah and the code is well readable.
Ill post it if i have further news.
As an aside a cheap but very good logic analyzer, I have 2 of them,
they work great.
On the logic analyzer does it have software or do you need to download one of the programs from the site on the next line from the web posting?
reducing the speed did the trick. i saw on the scope also a weak connection on the MOSI wire ^.^ could happen. even it alwas read 0 ohms on the meter ?.? okay now i get the status messages from the rc522. When i transfered all the Libraries to the PSOC Ill post it back here or on my page and a Link here. I can tell You. THIS IS FREAKIN AWESOME. ^.^
Ah @hli are You hlipka ??
@lexarion: Yes, we are the same person
Glad you got it working (even though my speed reduction tip was aimed at using my Logic Analyzer project, not at your problem ...)
Nice. Ill have a look what the max speed is which is supported by the rc522 but im glad that this is working.
One question. I only need the logic analyser part of your firmware which parts are they ?? Or where should i look in ? Because all is wonderfull divided into seperate parts and so there are many different files.
I would just keep the analog stuff in there, it doesn't hurt. Maybe its not obvious, but you can use it with a client for the openlogic sniffer (Jawi OLS is the best one available right now) too, instead of the GLCD.
If you really want to create a LA out of it: start with ripping out the SAR ADCs, their DAM and their input handling (the PGAs). Then look at the triggers. From there you need to clean the source code from all unreferenced stuff (most of it should be in scope.c/.h). Next would be DMA.c, and from there you will see that the display code in main.c needs to be touched. Also look at the menu code in handler_local.c to remove all the analog setup stuff. When you do that, you can probably increase the frequency options since the ports can run faster than the ADCs.
As I said, its easier to keep it in there 🙂
@lexarion - did you ever build a Psoc lib for the MFRC522? I'm a psoc newbie and trying to port over some MFRC522 code to Cypress devkit. Or if you got the reader working I would love to take a peek at your code kind sir 🙂