MQX 4 SPI Problem TWR-K60F120M

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX 4 SPI Problem TWR-K60F120M

ソリューションへジャンプ
2,796件の閲覧回数
terencet
Contributor III

I've been trying to get SPI working in MQX.

I have already got it working bare metal by just writing to the addresses, and thought that I could just use the same code in MQX.

I have connected up SPI1 and SPI2 using the Prototyping board and am just sending one byte messages one way. When I try to get it to work in MQX I can see that the messages are being sent but nothing is happening on the receiving side. This also happens when I try to use MQX's SPI driver, I get the exact same problem. I've noticed that in both I can't seem to change the PCSIS value in the MCR register it is always 0xFF no matter what I set it to(I can change it in the baremetal version).

Has anyone experienced any similar problems or know what might be causing this?

I'm using keil's uVision 5 and the TWR-K60F120M board.

タグ(4)
0 件の賞賛
返信
1 解決策
2,523件の閲覧回数
terencet
Contributor III

So I revisited this recently and started again using the same code I was using before and I was able to get both working just by writing to the registers. I have absolutely no idea why it wasn't working I'm pretty sure I'm using the exact same stuff as I was before there are a few small problems now but they don't seem to be related to what ever problem I had.

Most likely I was just being very very stupid and missed something very obvious.

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,524件の閲覧回数
terencet
Contributor III

So I revisited this recently and started again using the same code I was using before and I was able to get both working just by writing to the registers. I have absolutely no idea why it wasn't working I'm pretty sure I'm using the exact same stuff as I was before there are a few small problems now but they don't seem to be related to what ever problem I had.

Most likely I was just being very very stupid and missed something very obvious.

0 件の賞賛
返信
2,523件の閲覧回数
terencet
Contributor III

OK For some reason I'm not to sure why I have been able to get SPI communication working.

SPI1 works using the SPI driver but not by writing directly to the registers.

SPI2 works by writing directly to the registers but not by using the SPI driver.

This seems absolutely bizarre I'm checking through the MQX source to see if I can find anything but so far it hasn't turned up anything. If anyone can think of a reason why this would be happening I'd love to know but for the mean time I'll just work with what I have.

0 件の賞賛
返信
2,523件の閲覧回数
terencet
Contributor III

Ok so I got messages sending and receiving by setting PCSIS to 0xC0 (it still wont go to 0) but all I'm getting on the other end is rubbish. Will update if I can solve it but I'd really like to know why I can't set PCSIS to 0, is it something MQX sets up and then can't be changed?

Any help would be appreciated.

0 件の賞賛
返信
2,523件の閲覧回数
terencet
Contributor III

I've just noticed that the two bits that are set in 0xC0 are actually reserved bits not part of PCSIS.

Does anyone know why these would be set in MQX?

I just checked and they definitely are clear in the bare metal version and that is the only difference between the two versions.

0 件の賞賛
返信