Maple Mini SPI Slave – data get corrupt

ncw2k69
Wed Jul 27, 2016 8:56 pm
Hi everyone,
I need help! :(
On SPI protocol in slave mode, after some time (5-10min) the byte that i received from master is corrupt, data on logic analyzer shows correctly.
After i try to send a byte to master, the spi interface becomes unresponsive, but the rest of code works.
I tested with 2 maple mini boards, one in master mode and the other in slave, they seems to work ok, but doesn’t work with the other cpu i described above.
I’m trying to split apart the mainboard cpu from a display with keypads. After using the logic analyzer i assumed that the comunnication protocol is SPI, i have a single data line (receive-transmit), clock line, chip select and a key request line that goes high when a key is pressed. Package size is one byte (8bits) and SPI mode/phase is 1,1 sor spi_mode_3

For writhing code i use leaflab ide, the green one…

On arduino uno, the program runs correctly


Pito
Wed Jul 27, 2016 8:59 pm
Mind the SPI slave mode clock speed is usually limited. So double check the SPI clock speeds.

ncw2k69
Wed Jul 27, 2016 9:02 pm
the cpu i’m trying to comunicate is around 175khz… or something like that, is a very old one.
in my case the spi master (cpu) sends the clock, not the slave
… or i’m doing something wrong

Pito
Wed Jul 27, 2016 9:11 pm
Your
MM is the Slave
Old_CPU is the Master? Is the old_cpu 3.3V SPI signaling?

ncw2k69
Wed Jul 27, 2016 9:15 pm
Mainboard CPU (Master) – Maple Mini (Slave) on SPI 2 – when i do spi.transfer i get a corrupted byte
Maple Mini (Master) – Display with keypad (Slave) SPI 1 – this one works perfectly

Old cpu is 5V and i use a logic convertor from 5v to 3.3v

I’m trying to place Maple Mini between Cpu and Display


Pito
Wed Jul 27, 2016 9:19 pm
Logic convertor = issues :)
What kind of it do you use?

ncw2k69
Wed Jul 27, 2016 9:20 pm
in my area i use this one https://www.robofun.ro/logic-level-conv … 0convertor
i think is a sparkfun clone, or someting…

Pito
Wed Jul 27, 2016 9:32 pm
When the Old_CPU is the master, how do you do the Slave’s reading the SPI register? Not sure MapleMini has got the Slave mode implemented via spi.transfer..
http://www.stm32duino.com/viewtopic.php … =10#p13036

ncw2k69
Wed Jul 27, 2016 9:37 pm
Spi.beginSlave and then a made a new method that check if i have data in buffer, if true, i do spi.read or spi.transfer
I will post the code i use after i get back from work :roll:

stevestrong
Thu Jul 28, 2016 8:28 am
reception buffer overflow? (but only after a while? hmmm)
How do you differentiate between spi.read and spi.transfer?
Actually, when receiving SPI data, some data will be anyway read out from the master, and if you don’t set it, random data may disturb your spi master.

ncw2k69
Fri Jul 29, 2016 8:09 am
thanks to Pito, manage to make it work, i swapped the resistors position from Master – Res – Conv – Mini to Master – Conv – Res – Mini and now i have a strong data signal output from master

martinayotte
Fri Jul 29, 2016 1:36 pm
Do you means that you had placed a pullup on the wrong side of the converter ?
Image
Here we see pullups on both sides, but this is because it is a bi-directional level-shifter, such as I2C.
When used as uni-directional, only the receiver side requires a pullup.

ncw2k69
Fri Jul 29, 2016 5:55 pm
In the original scheme for cpu, on comuication wires are resistors in series, see attached picture

martinayotte
Fri Jul 29, 2016 6:31 pm
Why do you need those resistors in series ?
The board you are using has 4 times the schematics I’ve provided, there is no need for those series resistors.

ncw2k69
Fri Jul 29, 2016 6:47 pm
i think they were put there to limit current when display enters/exits stand-by

ncw2k69
Fri Jul 29, 2016 7:15 pm
is a way to do reset from code on maple mini?

martinayotte
Fri Jul 29, 2016 8:51 pm
You can jump to the reset vector, but it won’t be the same as doing external reset, especially is reset line is also used to reset external peripheral.
But, you can also use an GPIO attached to RES and trigger it from software.

ncw2k69
Fri Jul 29, 2016 9:11 pm
managed to do the reset function, it works

//hardware\leaflabs\cores\maple\nvic.h
void nvic_sys_reset();


Leave a Reply

Your email address will not be published. Required fields are marked *