FM4-176L-S6E2CC-ETH MFS Serial Timer

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JaSe_4725481
Level 1
Level 1
First reply posted First question asked

Hello,

I am working with the FM4-176L-S6E2CC-ETH Starter Kit and the IAR embedded workbench IDE. I would like to use the serial timer function of the MFS Channels in CSIO mode (found that in the communication manual and in the PDL drivers), but I can not set any of the registers. Now i am wondering if this feature is maybe not available at all with my MCU.

More information:

MFS Channel 4, sending and transmitting works fine, same for setting interrupt and FIFO config.

All the relevant register values (CSIO_SACSR etc.) are shown as 0xFFFF

Thanks in advance for your help.

0 Likes
1 Solution

Dear Jan,

I slightly may have to revise my first feedback to you, it looks probably the Serial Timer is implemented only for MFS channels supporting Serial chip select function (S6E2CC ch 6 and ch 7 only). At least I got the timer working for MFS6:

     FM4_MFS6->SMR =  0x43u;     // clock synchronous mode (2), Eanble clock and data output

     FM4_MFS6->SACSR_f.TMRE = 0;     // Disable Serial Timer

     FM4_MFS6->SACSR_f.TSYNE = 0;     // Serial Timer usage: Timer

     FM4_MFS6->SACSR_f.TDIV = 7;     // DIV128

     FM4_MFS6->SACSR_f.TINT = 0;     // Clear flag

     FM4_MFS6->SACSR_f.TINTE = 1;     // Enable IRQ

     FM4_MFS6->STMCR = 0x1FF0;     // Comparison register

     FM4_MFS6->SACSR_f.TMRE = 1;     // Enable Serial Timer

 

     bFM4_GPIO_DDR2_P4 = 1;     // Use P24 for oscilloscope testing

     bFM4_GPIO_ADE_AN29 = 0;     // Use P24 as GPIO

 

     while(1)

     {

          if (FM4_MFS6->SACSR_f.TINT == 1)

          {

               bFM4_GPIO_PDOR2_P4 = !bFM4_GPIO_PDOR2_P4; // Pin 154, P2.4, Oscilloscope testing

               FM4_MFS6->SACSR_f.TINT = 0;     // Clear flag

          }

     } // while(1);

I am trying to get more information ...

Regards,

Holger

View solution in original post

6 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

The FM4 CSIO code examples in PDL2.1.0 might be helpful for your use case - https://www.cypress.com/design-guides/peripheral-driver-library-pdl-psoc-creator

0 Likes

There is no code example for the serial timer of the MFS module, only examples for CSIO polling, interrupt and chip select. There are drivers and config structures for the serial timer in the PDL, but they are not working for me. Even disabling the serial timer with "Mfs_Csio_DisableFunc(CsioCh4, CsioSerialTimer);" is not working. The TMRE bit is still set to "1".

If you have any other idea or can confirm that the feature should work with the S6E2CC series, I would really appreciate it.

0 Likes

I am quite sure the feature should work with S6E2CC, and it looks the register is known in your project, otherwise you would get some compilation error. Honestly, I have never tested by my own that feature, and have never seen an example code. Let me check next week whether I can prepare an example.

Btw, what exactly do you like to realize by using that timer?

regards,

Holger

0 Likes

Good morning Holger,

thank you for your answer. It would be really helpful to have some sort of example code.

I want to use the timer as am interrupt source to ensure a smaller delay. I transmit data depending on signals on my input pins and I would prefer a delay as small as possible between an edge change on my input signal and the transmission of the corresponding message. I already tried the other interrupt settings (Idle/ TDR empty / FiFo full) with mixed results.

The Idle interrupt of course leads to short idling phases of my transmit channel and thereby an increase in time needed to transmit one message.

The TDR empty interrupt leads in the worst case to a delay of 3 messages for me (less if i split my message into two transfer packages).

Also I am reliant on the MFS interrupt options because it should be a "hardware" implementation. The CPU should only initialize the needed peripherals and afterwards be free for other tasks.

0 Likes

Dear Jan,

I slightly may have to revise my first feedback to you, it looks probably the Serial Timer is implemented only for MFS channels supporting Serial chip select function (S6E2CC ch 6 and ch 7 only). At least I got the timer working for MFS6:

     FM4_MFS6->SMR =  0x43u;     // clock synchronous mode (2), Eanble clock and data output

     FM4_MFS6->SACSR_f.TMRE = 0;     // Disable Serial Timer

     FM4_MFS6->SACSR_f.TSYNE = 0;     // Serial Timer usage: Timer

     FM4_MFS6->SACSR_f.TDIV = 7;     // DIV128

     FM4_MFS6->SACSR_f.TINT = 0;     // Clear flag

     FM4_MFS6->SACSR_f.TINTE = 1;     // Enable IRQ

     FM4_MFS6->STMCR = 0x1FF0;     // Comparison register

     FM4_MFS6->SACSR_f.TMRE = 1;     // Enable Serial Timer

 

     bFM4_GPIO_DDR2_P4 = 1;     // Use P24 for oscilloscope testing

     bFM4_GPIO_ADE_AN29 = 0;     // Use P24 as GPIO

 

     while(1)

     {

          if (FM4_MFS6->SACSR_f.TINT == 1)

          {

               bFM4_GPIO_PDOR2_P4 = !bFM4_GPIO_PDOR2_P4; // Pin 154, P2.4, Oscilloscope testing

               FM4_MFS6->SACSR_f.TINT = 0;     // Clear flag

          }

     } // while(1);

I am trying to get more information ...

Regards,

Holger

Dear Holger,

that is really helpful! I should have checked that before I guess. Luckily, Ch6 is also a highspeed channel, so I can simply switch both my channels to the chip select ones. Although it seems like I need to solder a bit to get access to the corresponding pins If you find more information feel free to share them, maybe it is possible to get the feature working for the other channels as well.

Regards,

Jan

0 Likes