Bug #1804

[H2AI] SPI issue

Added by Luiz Fernando Lavado Villa 6 months ago. Updated 5 months ago.

Start date:
Due date:
% Done:


Estimated time:


In the three-phase board, there is an issue with the declaration of the SS1 of the SPI. The pin that was declared on the schematics in KiCad is RB2, as shown below:

However, when using the MCC, we've realized that the pin that should be used is RB0. So, instead of using it, we declared RB2 as GPIO and we will compensate it via software. Here's a screenshot of what MCC gave us.

Here you can see the pinout. We've selected RB2 as GPIO output.

Here you see the pin select window. In it we can see that SS1 has to be declared on RB0.


declaration_original_SS2.png (5.43 KB) declaration_original_SS2.png Luiz Fernando Lavado Villa, 2020-01-24 17:38
PINOUT_MCC.jpeg (173 KB) PINOUT_MCC.jpeg Luiz Fernando Lavado Villa, 2020-01-24 17:44
PIN_SELECT_MCC.jpeg (195 KB) PIN_SELECT_MCC.jpeg Luiz Fernando Lavado Villa, 2020-01-24 17:44
spi1.png (68.6 KB) spi1.png Guillermo Catuogno, 2020-02-02 18:39
spi2.png (108 KB) spi2.png Guillermo Catuogno, 2020-02-02 18:39

Updated by Luiz Fernando Lavado Villa 6 months ago

  • Subject changed from SPI SS1 pin issue to [H2AI] SPI SS1 pin issue

Updated by Guillermo Catuogno 5 months ago

Hello all, I have some doubts about what SPI we are using, I was testing with SPI2, This is SPI1

But in pin 17 and 18 we have link to TXD and RXD so I think we use SPI2 (SS1 (pin 6) still have problems in SPI2)


Updated by Luiz Fernando Lavado Villa 5 months ago

  • Subject changed from [H2AI] SPI SS1 pin issue to [H2AI] SPI issue

Updated by Luiz Fernando Lavado Villa 5 months ago

We've made some progress on the SPI. Here are the things we've done on this front since we arrived in Glasgow.

Initial improvements: We found how to send MOSI, CLK, SS and SS1

We started by working on the code to ensure ourselves we could send the data correctly. In this case the limitation was the fact that the SPI2 clock had to be mapped by hand. We managed to do that an the clock worked.

The next step was to find the appropriate SPI mode, in our case 0 (zero).

An error: ISO7341C does not work with MCP3208

We realized, after a long time trying, that the ISO7341C is active high, and not compatible with the MCP3208. The only solution is to change all of them to ISO7341FCs.

The real issue: MISO does not work with two ISO7341FCs in parallel

When two ISO7341FCs have their MISOs connected in parallel, their impedance is halved. This creates a situation where the MISO voltage falls below the detection level. Thus, even if we have to right measurements, the dsPIC was uncapable of reading it.

The solution: Forced isolation

The solution for the issue is to cut the MISOs and force an isolation. Our improvised isolation circuit was an optical isolator, which created the issue of inverting the actual data.
I'll paste some photos here.

Also available in: Atom PDF