Pin 4 can't be used at a high speed?
#1
Posted 14 May 2011 - 04:03 PM
If I look at the specs pin 4 is the only pin that doesn't have managed support for a protocol, but for a chip select pin that shouldn't be a problem I suppose?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#2
Posted 14 May 2011 - 04:21 PM
#3
Posted 14 May 2011 - 05:31 PM
namespace NetduinoApplication1 { public class Program { public static void Main() { SPI.Configuration Config = new SPI.Configuration( Pins.GPIO_PIN_D4, false, 0, 0, true, false, 1000, SPI_Devices.SPI1 ); SPI Leds = new SPI(Config); byte[] WriteBuffer = new byte[1]; while (true) { WriteBuffer[0] = 1; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 2; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 4; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 8; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 16; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 32; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 64; Leds.Write(WriteBuffer); Thread.Sleep(100); WriteBuffer[0] = 128; Leds.Write(WriteBuffer); Thread.Sleep(100); } } } }
I connected 8 leds with a 74HC595 to the Netduino like this:
If I change pin 4 to any other (both in code and in the schematic) it works, but on pin 4, nada.
By the way, the above code and schematic is only a simple thing to reproduce which I built in 5 minutes, the problem occured in a bigger project I am working on, but that code was too big and too much overhead
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#4
Posted 14 May 2011 - 05:50 PM
#5
Posted 14 May 2011 - 05:53 PM
Hahaha it's just a versatile IC, I'm not using it to -really- multiplex in this project, but it's still a nice sampleWithin this year, we might buy the brand new book of Stefan: "Netduino and 74HC595 Unleashed".
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#6
Posted 14 May 2011 - 09:51 PM
#7
Posted 17 May 2011 - 01:49 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#8
Posted 17 May 2011 - 01:57 PM
There are a few other issues we're working on for 4.1.1 beta 2 (and are also preparing for MakerFaire)--so this may take a few days to get to.Did you manage to reproduce it? I guess you're working hard and are quite busy
Chris
#9
Posted 17 May 2011 - 01:59 PM
No problemo, I'm using a different Latch pin at the moment and use Pin 4 for GPIO only. I'm just curious what causes this problemThere are a few other issues we're working on for 4.1.1 beta 2 (and are also preparing for MakerFaire)--so this may take a few days to get to.
MakerFaire; why are there so little of such events in Europe?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#10
Posted 27 May 2011 - 08:13 PM
Pin 4 won't work as latch on:
- Netduino (v4.1.1.0 b1) by Secret Labs LLC
- Netduino Plus (v4.1.1.0 b1 with extra RAM) by Secret La
Now comes the interesting part. I took the mini, and tried the only non-managed pin, Pins.GPIO_PIN_13. Same result, not working as latch pin! Tried:
- Netduino Mini by Secret Labs LLC (4.1.0.5)
Does that also count for pin 13 on the Mini?Digital pin 4 is the "hardwired" chip select pin for the SPI bus. Microsoft included special handling for it in the SAM7X board support package, to special-case it.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#11
Posted 27 May 2011 - 10:23 PM
Yes, exactly same pin configuration and same issue. .NET MF includes a special case for the SPI_SS pin in the SAM7X firmware. We're looking at it, and there are some timing differences between cases that we need to account for. I'll post more as we test the solution.Does that also count for pin 13 on the Mini?
Chris
#12
Posted 31 May 2011 - 02:02 PM
#13
Posted 31 May 2011 - 02:05 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#14
Posted 31 May 2011 - 03:02 PM
It's up to Chris to reply for a permanent fix, but!
If you need it quickly I can try to write a software work-around for it, I think it's possible. Only requirement would be that you use a modified version of my MultiSPI class. I have an idea about how to work around the problem. It will slow down the SPI bus a bit though, if I get it to work.
I'd be curious to see what is causing this problem in the firmware. I haven't delved into it to even know what's going on in there yet, but I'm sure I will sometime. I just was hoping it'd be on my own terms, lol.
Also, I've heard you talk about the MultiSPI class, but haven't seen it. I'd like to see if we can use it.
#15
Posted 31 May 2011 - 03:09 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#16
Posted 31 May 2011 - 04:25 PM
Attached Files
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#17
Posted 31 May 2011 - 05:30 PM
Could you try if the attached project "fixes" your problem?
I looked at the code, and it looks like the things I was going to try. I just had no idea (I didn't try) that the SPI port would function properly if configured with GPIO_NONE as the SSEL pin. I'll have to go ahead and try just using the pin externally until there is a firmware fix.
Maybe in my free-time I'll look into the firmware myself and figure out if there's a quick fix... Until then, this patch should work.
Thanks for your help! I'll have to look into the amount of time lost in the managed code fix. I am sure it's relatively hefty.
#18
Posted 31 May 2011 - 06:12 PM
Normally, you'd be limited to a certain subset of pins that you could use for SPI chip select (4 in the case of the SAM7X microcontroller used on Netduino), but .NET MF does a "software SPI select" which lets you use any pin.Any word on what causes this in the Firmware; or a fix for this? I am working on a project and we just so happened to already design a board to use this pin as a SSEL pin on the Netduino Mini... That was of course before we tried that same hardware-SPI pin on the Netduino and found it didn't work.
The side effect is that there is a "special case" in the .NET MF firmware for the main hardware SPI chip select pin. There are some slight timing/selection issues between hardware and software SPI select. We looked at these once during the development of .NET MF 4.1 beta, and are running through them again to get a permanent fix in place. The fix should be posted in the next week or two (although it may basically be the same thing that Stefan is proposing here--a software select override).
Chris
#19
Posted 13 September 2011 - 04:38 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#20
Posted 15 September 2011 - 09:48 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users