uhorkovyprivarok / GEN4-FT813-50CTP-CLB-4D-Systems_a_TMS320F28335

0 stars 0 forks source link

missing project files #1

Open RudolphRiedel opened 2 years ago

RudolphRiedel commented 2 years ago

I am trying to import this into CCS and it is missing all the project files. Please add: .ccsproject .cproject .project And perhaps the .settings folder.

No, I have no clue what I am doing with CCS so far. :-)

uhorkovyprivarok commented 2 years ago

Ok sorry my bad, I have added them try now.

RudolphRiedel commented 2 years ago

I had to rename the dir to "BP-Displej-zaklad" in order to import the project into CCS11. And now it does not build since somehow it can not find the device support for CC2000, more specifically it can not find DSP2833x_Device.h. And this little exercise renews my hatred of eclipse. :-)

RudolphRiedel commented 2 years ago

Well, "C2000 Device Support" in version 6.3.0.0 is installed but it is not in c:ti and I have not found where it hides...

uhorkovyprivarok commented 2 years ago

Well I am not CCS master also because it is school project and my teacher help me with it little bit specially with CCS.. I have lessons with him Mondays at 12:00 so if you don´t move on until then he will help us on next monday xD

We have installed something on the start of the project but I can´t remember now how it was, but if I remind I will write..

I have som pics but I don´t know if it helps..

image image

RudolphRiedel commented 2 years ago

I am missing this one: C:\ti\C2000Ware_4_00_00_00\ Despite CCS11 is telling me that device-support is installed already. This is this: https://www.ti.com/tool/download/C2000WARE And it requires a login. Well, I do have my work notebook here and I do have an account with TI thru my work...

uhorkovyprivarok commented 2 years ago

Well i can share that folder if it helps..

RudolphRiedel commented 2 years ago

I better install it and the only issue so far is to get TI to validate my account, their server is really slow right now.

uhorkovyprivarok commented 2 years ago

Okay.. :D I shared it already btw..

uhorkovyprivarok commented 2 years ago

yea and btw I only connected: power: 27 = 5v+ 30 = GND

and for SPI 4 pins: 4 = SPI_CS 6 = SPI_MOSI 7 = SPI_MISO 8 = SPI_SCK

link for datasheet: https://4dsystems.com.au/mwdownloads/download/link/id/762/

Is it enough am I right?

And the question about SPI_CS is it on pic bellow the DEN signal? so it has to be high when communicating?

image

RudolphRiedel commented 2 years ago

You need SPI_PD as well, so pin 2. And that timing diagram is completely useless in this context, this is for the panel itself, so what is after the FT813. SPI_CS is active low.

Adding the includes manually worked now, my account with TI still is not verified... It builds now so I can have a closer look.

uhorkovyprivarok commented 2 years ago

Happy to hear that it worked.. Uhm I understand.. So maybe check if I have set SPI good because I set it as the diagram on the photo show.. You can also see in code that we added cs mannualy to high because the DEN confused us.. And why is there needed the SPI_PD? Isn't that only for sllep mode?

RudolphRiedel commented 2 years ago

SPI_PD is powerdown, I am using it for a hard reset in EVE_init(). Otherwise a software reset of the registers would be required, this is possible but not preferred.

uhorkovyprivarok commented 2 years ago

Uhm.. Ok I understand now..

RudolphRiedel commented 2 years ago

I am going over the changes you did. First finding, replacing DELAY_MS with DELAY_US in EVE_commands.c was not necessary and implemented incorrectly, this would be a factor of 100, not 1000.

I see to pick up what you already did and modify it to the way I intended this to work. So is GPIO14 correct for SPI_PD?

uhorkovyprivarok commented 2 years ago

uhm, understand about that delay.. thanks for correction..

Of course you can.. I appreciate that.. mm yes the GPIO14 is free, so it can be used as SPI_PD

RudolphRiedel commented 2 years ago

Time to take a break for the night, to be continued tomorrow evening. But I can already tell that this might get ugly since it looks like that a byte in the C2000 has 16 bits.

uhorkovyprivarok commented 2 years ago

Yes it is.. :D Well we will see.. The microcontroller was chosen for controlling cnc drill machine - it was the first project and now we are doing update for it so we are going to add display.. But it is harder than we thought.. Thanks a lot for today sir..

RudolphRiedel commented 2 years ago

Ok, I pushed files for a first test. The EVE_xxx files are replaced with a fresh copy of the current versions. EVE_target.h has a new target: TMS320C28XX There is not much to go on about with the C2000 compiler, it does hardly pre-define any usefull symbols.

The mostly verbatim copies are meant to make things easier for you when I change something later on.

The new target section is to keep it portable, this is like I will release this once this works like intended. Well, with credit and releasenotes.

I have not really looked at the function though so far.

I added a DELAY_MS() function, or rather I copied it from one of the other targets. It does not need to be precise, it only is needed for EVE_init() and it will work as long as the time spent is not significantly less than 1ms per inner loop.

This should work for the most part: typedef uint_least8_t uint8_t;

After this an uint8_t is 16 bits wide but I hope this is not an issue. And I checked, a real problem would have been int8_t but there is none. At least it builds this way.

Finally I replaced the display list commands in main.c with a EVE_init() line.

And now it would be your time to try this. Now the more interesting question, do you have a logic analyzer at hand? We need to check out what is happening on EVE_PDN and the SPI before we should continue.

uhorkovyprivarok commented 2 years ago

Hello, wow that looks great.. I will try it tomorrow, today was hard day and only thing I want to see is my favourite pajamas on me and my bed.. :D

I don't have logic analyzer at home maybe in school.. In school I have also oscilloscope.

RudolphRiedel commented 2 years ago

An oscilloscope is not of much use for this as the packets are a bit longer. A cheap logic analyzer would do just fine, although at reduced SPI clock, something like this: https://www.amazon.de/ZHITING-Analyzer-Analyzer%EF%BC%8C24MHz-USB-Kabel-kompatibel/dp/B098TGKPPZ/ Combined with Sigrok/Pulseview. Max SPI clock would be 2MHz, maybe 4MHz but the first step is to get this to work, not make it fly. :-)

uhorkovyprivarok commented 2 years ago

Hello, I have photo what comes out from SPI. CS is inverted on pic, but already rewrited it right in code.. Also made small changes with my teacher. Changes:

scope_0

uhorkovyprivarok commented 2 years ago

tek00001

RudolphRiedel commented 2 years ago

This looks very promising, only the CS is going high a bit early. Do you have the decoded MOSI / MISO values for the second image?

RudolphRiedel commented 2 years ago

I checked out the spi_transmit() function in EVE_target.h and had a peek into the reference manual. And I like to suggest to do spi_transmit() a little different.

static inline void spi_transmit(uint8_t data)
{
    SpiaRegs.SPITXBUF = (data & 0xFF) << 8; /* looks odd with data = uint8_t but uint8_t actually is 16 bits wide on this controller */
    while(SpiaRegs.SPISTS.bit.INT_FLAG == 0); // wait for transmission to complete
    (void) SpiaRegs.SPIRXBUF; /* dummy read to clear the flags */
}

This is not fundamentally different, only a couple of clock-cycles faster.

while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG == 1); // wait for ready state

This is not really necessary since there either was no transfer before this or the previous transfer waited for the transmission to be finished.

if(SpiaRegs.SPISTS.bit.BUFFULL_FLAG == 0) SpiaRegs.SPITXBUF = (data & 0xFF) << 8;

This is redundant in combination with the previous line, why wait for the bit to be zero and then re-check if it is zero?

(void) SpiaRegs.SPIRXBUF; / dummy read to clear the flags /

This generates code to read the register but what is read is ignored. So this is clearing the flags with a minimum of clock cycles.

I would like to see the the timing of the PD line after reset to check if the rough delay function is on point. Also I would like to see the end of a transfer in more detail to make sure CS is not going high too early.

The clock could be increased, maybe use 2MHz as a start, during init it needs to be below 8MHz though.

RudolphRiedel commented 2 years ago

Well, a full log of the first 200ms or so after reset would be nice, from start of activity on the SPI to the end. :-)

RudolphRiedel commented 2 years ago

I just checked DMA in the TMS320F28xxx and the SPI unit does not support DMA. In order to use SPI with DMA one needs to use one of the McBSP units in SPI mode. The TMS320F28xxx really is a strange one.

uhorkovyprivarok commented 2 years ago

Well I will try to make photo you want, but my logic analyzer will come on friday.. the proces of initialization fail on timeout.. somehow can´t read the right ID from display.. I replaced spi_transmit, but still same problem.. ;P

Just to make sure, reading should be on 4th bit or 5th? because on the pic I sent you see that data are coming on 2nd, 3rd, 4th, but none of them are right either..

RudolphRiedel commented 2 years ago

This is why I asked about the decoded values from the image above. :-)

A correct sequence would look like this: https://user-images.githubusercontent.com/31180093/103231605-7a131800-4938-11eb-80e7-1420d91e0084.png

0x30 0x21 0x2c is reading from REG_TOUCH_TAG, 0x00 is a dummy byte and with the last 0x00 the value is read. This is an EVE_memRead8() call. A write sequence starts with 0x80 + 22 bit address and as registers are located at 0x302000 this is usually 0xb0.

The return from the EVE chip always is 0x00 0x4a 0x43 0x43, followed by whatever data is to be read if the issued command was to read. At the very beginning though, for the first 4x ms after powerup, there is no response at all, this is why I put annother delay in EVE_init() before reading of the chip-id starts.

uhorkovyprivarok commented 2 years ago

Well, I don´t have good news.. the logic analyzer that came don´t work.. I bouhgt same like you sent, but somehow the PC can´t find that logic analyzer.. I connect it but PC don´t see it.. I have been searching and found out that chinese eeprom don´t work with windows or something like that..

RudolphRiedel commented 2 years ago

These thing do not have a real firmware, only a ROM bootloader, the application is pushing the firmware on the device, every time. So in this case this would be the sigrok driver.

Check with https://www.uwe-sieber.de/usbtreeview_e.html if windows at least detects the chip.

uhorkovyprivarok commented 2 years ago

Nope.. sigrok can´t find it too.. I am trying to install driver manually but windows is dumb ass.. Problem can be that I have the latest version of windows or idk where..

If you have something like Microsoft Teams you can try to control my pc and try to make it run but I am done for today..

uhorkovyprivarok commented 2 years ago

Okay something is showing on COM3 but idk if it is right.. see pic.. image

RudolphRiedel commented 2 years ago

I have no Teams on my Win11 machine right now, I refused to get a Microsoft account for a long time and now that I actually tried to get one they failed to send the confirmation mail in the process.

Anyways, this is actually looking good. The LA has a Vendor ID 0x08A9 and a product ID 0x0014. And according to this it should be supported: http://sigrok.org/wiki/Fx2lafw#Hardware_overview This is most likely a clone of this one: http://sigrok.org/wiki/ARMFLY_Mini-Logic

I got annother one with a different Vendor ID, mine has 0x0925 / 0x3881. So I just downloaded the latest nightly: http://sigrok.org/download/binary/pulseview/pulseview-NIGHTLY-64bit-static-release-installer.exe and installed it.

grafik grafik grafik grafik

And it is up and running now.

uhorkovyprivarok commented 2 years ago

Still nothing :/ image Searched for all but nothing found..

uhorkovyprivarok commented 2 years ago

But chip on the back of the LA is right as you expected.. image

uhorkovyprivarok commented 2 years ago

okaay so idk if LA works right but this is what he shows..

Zoomed out pic: image Zoom in (start): image Zoom in red number 2 on pic 1: image Zoom in (red number 3 from pic 1, first transfer) image Zoom on red number 3 from pic 1: image

uhorkovyprivarok commented 2 years ago

Ok my bad.. maybe edit will make more sense.. xD

uhorkovyprivarok commented 2 years ago

hmm there is second try.. but looks little bit difrent.. this is same zoom as 3rd pic on previous comment.. or red number 2 on 1st pic.. image Hope you understand.. :D

uhorkovyprivarok commented 2 years ago

okay on 1MHz it looks like this.. wired bcs it should be set for 500kHz.. still same pic as before.. 3rd pic on first comment.. or red number 2 on 1st pic.. image

RudolphRiedel commented 2 years ago

Totally unrelated I had a really bad afternoon yesterday. Anyways...

This is looking promising, we are getting close. Please setup the sample rate much higher, when the SPI is supposed to be running at 500kHz sampling it with 8MHz would be nice and higher would not hurt.

Then we have a couple of issues. First is that the rough delay from DELAY_MS() looks like to be way too long, the 21 ms initial delay are over 70ms. Not really an issue now but this either means that the controller is not running at 150MHz or the loop in the function is not needing 6 cycles to complete. Either way a longer delay does not hurt and this is something to be tweaked when everything else works. I would like to see a zoom of the area marked "3" between to transfers, these should be about 1ms apart.

Next is that the SPI is sending too many bytes. There should be only 3 bytes in the last image but there are 6. In the earlier shot there were 4 which is still too many but what did you change in between?

And the last issue is that chip select is going high too early in a few shots, although it was just ok in the last shot. This indicates that the flags are not behaving as expected.

Soo, what did you change in the SPI setup for the last shot?

Please do a new run with a higher sample rate and attach the logfile as well.

uhorkovyprivarok commented 2 years ago

No problem.. everybody have bad time sometimes..

Every day I have to set all up in Pulswiew so I already set it on 8Mhz as you can see up in the program on the every pic.. And it looks way too much better..

About the question about last pic, I changed just frequency in PulsWiew, nothing with code..

Here is Zoom out: image

So here is pic of area marked "3" - between the transfers image

There is first send of the marked area "3" image

I am not sure how to make log file? image

When I save it I have formats: ".pvs", ".sr" do you want these?

uhorkovyprivarok commented 2 years ago

And here is marked area "2" image

uhorkovyprivarok commented 2 years ago

Here is marked area "2" in detil... I just made it by hand so it isn´t perfect.. image

RudolphRiedel commented 2 years ago

I just checked and found a trace that I took last year with pulseview, so .sr would be correct. This one is for a BT815 though so there is one command extra for the first block. rr_EVE5_test.zip

So here is pic of area marked "3" - between the transfers

So the pause that is supposed to be 1ms long is actually 3.5ms long.

And here is marked area "2"

This is looking really good, so these are actually two commands. I still find that lack of a pause after the transfer and CS going high alarming though.

Please throw in an extra NOP in the transfer functions, like this:

static inline void spi_transmit(uint8_t data) { SpiaRegs.SPITXBUF = (data & 0xFF) << 8; while(SpiaRegs.SPISTS.bit.INT_FLAG == 0); // wait for transmission to complete (void) SpiaRegs.SPIRXBUF; / dummy read to clear the flags / asm(" RPT #7 || NOP"); }

static inline uint8_t spi_receive(uint8_t data) { SpiaRegs.SPITXBUF = (data & 0xFF) << 8; while(SpiaRegs.SPISTS.bit.INT_FLAG == 0); // wait for transmission to complete asm(" RPT #7 || NOP"); return (SpiaRegs.SPIRXBUF & 0x00FF); // data are right justified in SPIRXBUF }

And one last thing, this was without the display?

RudolphRiedel commented 2 years ago

I just checked the project in order to find a disassembly file or the option to produce one to check out the delay. I did not find it but I saw that "Optimization level" is set to "off", please set it to "2" which should produce more realstic results.

uhorkovyprivarok commented 2 years ago

OK im back.. sry but I had problem with watter tap in bathroom so I had to fix it.. xD

So I added to my github file from PulsWiew because I can´t attach it here..

Yes the display is not connected because I plugged LA.. but I can connect it later with some extra wires..

I add NOP functions, so you want to see new result from PulsWiew? try to open what I uploaded on github so I can send you this because I think it is better for you too look at it on your own.. you can zoom and so..

Ok I will revrite Optimalization level right now..

uhorkovyprivarok commented 2 years ago

Sorry, but where I find that "Optimization level" ? :D

RudolphRiedel commented 2 years ago

Right-click on the project, select "Properties" at the bottom. grafik

And yes, I had to zip the file to add it directly to the chat. Edit, found the files, check it out.

RudolphRiedel commented 2 years ago

This really looks like it could be working now, the only odd thing left is the delay that is off by a factor of 3.5. But this may be gone with optimization turned on.

uhorkovyprivarok commented 2 years ago

Added files with optimalizated run..